EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: varonica on October 22, 2013, 12:36:53 AM



Title: DataGrid Buffer
Post by: varonica on October 22, 2013, 12:36:53 AM
I'm using datagrid buffer try loading a local data and it works perfectly.
But after i try a code below:

Code:

// html
<table id="dg" style="width:auto;height:369px" ></table> 

//script
<script>
$(document).ready(function(){
   $('#dg').datagrid({
        url:'get_users.php',
        title:'Domain',
toolbar:'#toolbar',
view:bufferview,
pagination:false, 
rownumbers:true,
//fitColumns:true,
singleSelect:true,
remoteSort: false,
autoRowHeight:false,
pageSize:50,
        columns:[[
     {field:'domain',title:'Domain',width:9,sortable:true},
   {field:'status',title:'Status',width:2.2,sortable:true},
   {field:'regdate',title:'RegDate',width:4,sortable:true},
   {field:'expdate',title:'ExpDate',width:4,sortable:true},
   {field:'url',title:'URL',width:10.5,sortable:true},
   {field:'webhosting',title:'WebHosting',width:8,sortable:true},
   {field:'info',title:'Info',width:8,sortable:true},
   {field:'contact',title:'Contact',width:6,sortable:true},
  {field:'other',title:'Other',width:5,sortable:true},
      ]],

   });
});

// get_users.php

$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$sort = isset($_POST['sort']) ? strval($_POST['sort']) : 'no'; 
$order = isset($_POST['order']) ? strval($_POST['order']) : 'asc'; 
$offset = ($page-1)*$rows;
$where = "WHERE is_deleted = 0";
$result["total"] = $wpdb->get_var("SELECT COUNT(*) FROM tbl_domain $where ");
$rs = $wpdb->get_results("SELECT *,DATEDIFF(expdate,NOW()) AS remain FROM tbl_domain $where ORDER BY $sort $order limit $offset,$rows");

$items = array();
foreach($rs as $row){
   $row->regdate = $row->regdate == '0000-00-00'?'':FormatDate($row->regdate,'d/m/Y');
   $row->expdate = $row->expdate == '0000-00-00'?'':FormatDate($row->expdate,'d/m/Y');
   array_push($items, $row);
}
$result["rows"] = $items;
echo json_encode($result);


IT KEEPS SENDING A REQUEST TO get_users.php.

Please help me !!!! :( :'(


Title: Re: DataGrid Buffer
Post by: varonica on October 22, 2013, 08:25:05 PM
THE PROBLEM OCCURRED WHILE I WAS TRYING TO SET A WIDE HEIGHT :) :)