smartec
							
								Newbie 
								 
								Posts: 4
								
								
								
								
								
								  
							 
						 | 
						
							
								  | 
								
									
									 «  on: January 10, 2016, 04:02:02 AM »  | 
								
								 | 
							  
							 
							Hi there,
  I have problems using easyui. I encountered that the data is not consistent (i.e. the datagrid can show outdated data)
  For example, I have data Item A with qty of 10pcs, after that I performed some actions on the Item A, and change the qty to 5pcs. Sometimes the datagrid shows the qty of Item A as 10 again even though the database already shows that Item A qty is 5 pcs. This thing happens when I refresh the datagrid using my "refresh" function. Any idea on what is going on?
  Here is my code for the datagrid and the reload function. The easyui version that I used is 1.3.6
  My datagrid function: <div data-options="region:'center',border:false,iconCls:'icon-ok'">               <!-- gaya table baru di grid -->              <table id="grid"            title="" iconCls="icon-edit"              singleSelect="true" rowNumbers="true"              pageSize="50"              fitColumns="true" remoteSort="false"              url="<?=base_url($menu_link.'/ajax')?>"              style="width:auto;height:560px"              data-options = "border:false,view:scrollview,autoRowheight:false"         >      public function ajax(){       $page   = ($this->input->post('page')) ? intval($this->input->post('page')) : 1;       $rows   = ($this->input->post('rows')) ? intval($this->input->post('rows')) : 150;              $hasil = array();                     $count_data = $this->db->count_all_results('at_purchaserequisition');              $offset    = $count_data - ($rows * $page);       if($offset > 0){          $rows = $rows;       }       else{          $rows = $count_data - ($rows*($page-1));       }       /*========================end=======================================*/       $result = $this->m_purchase_requisition->get_all();              for($i=0; $i<=($rows-1); $i++){          // kalau master ambil dari get_status_master(), kalau transaksi get_status()          $TransStatus = get_status($result[$i]->TransStatus);
              $hasil[] = array(              'BranchName'       =>   $result[$i]->BranchName,              'DepartmentName'    =>   $result[$i]->DepartmentName,              'PReqNumber'       =>   $result[$i]->PReqNumber,             'PReqDate'          =>   $result[$i]->PReqDate,              'PReqDesc'          =>   $result[$i]->PReqDesc,             'CreatedBy'       =>   $result[$i]->CreatedBy,              'Status'          =>   $TransStatus          );       }              if(empty($hasil)){          $emptyVar = array();          echo json_encode($emptyVar);       }       else{          $result = array();          $result['total'] = $count_data;          $result['rows'] = $hasil;          echo json_encode($result);       }        }
 
  My Reload function: <a href="#" class="easyui-linkbutton" id="refresh-linkbutton" data-options="plain:true,iconCls:'icon-reload'" onclick="$('#grid').datagrid('reload')">Refresh</a>
 
  Thanks in advance,
  Prawira         
						 |