Hi,
I’m trying to implement a grid using a datastore with paging enabled.
On the client side, it looks something like this
var grid_clients = cell_clients_list.attachGrid();
grid_clients.setIconsPath(dhtmlx.image_path);
grid_clients.setColumnIds(...);
grid_clients.setHeader( ... );
grid_clients.setColTypes(...);
grid_clients.setColumnMinWidth('60,*,*,*,*,*,*,*');
grid_clients.setColAlign('left,left,left,left,left,left,left,center');
grid_clients.enableResizing('true,true,true,true,true,true,true,true');
grid_clients.setColSorting('int,str,str,str,str,str,str,str');
grid_clients.setInitWidths("60,*,*,*,*,*,*,*");
grid_clients.attachFooter(["<div id='grid_clients_recinfoArea' style='width:100%;height:100%'></div>","#cspan","#cspan","#cspan","#cspan","#cspan","#cspan"],['height:25px;text-align:left;background:transparent;border-color:white;padding:0px;']);
grid_clients.init();
grid_clients.enablePaging(true, 25, 10, 'grid_clients_recinfoArea', true, 'grid_clients_recinfoArea');
grid_clients.setPagingSkin('bricks', skin);
var clientsDataStore = new dhtmlXDataStore( {url:'clients.php', dataFeed:'clients.php', datatype:'xml' } );
grid_clients.sync( clientsDataStore );
On the server side, the connector looks like:
$start = 0;
if(isset($_GET["start"])) $start = intval($_GET["start"]);
$count = 20;
if(isset($_GET["count"])) $count = intval($_GET["count"]);
$connector = new GridConnector($dbh->connection, "FrontBase");
// I implemented a custom frontbase connector which uses the syntax top(x,y) instead of limit(count)
if ($connector->is_select_mode()) //code for loading connector
{
$connector->set_encoding("ISO-8859-1");
$connector->dynamic_loading($count); // top(x, y)
//if this is the first query - get total number of records in the query result
if ($start == 0)
{
$sql = "select count(*) from Client where $where";
$totalCount = $dbh->getOne($sql);
}
$sql = "select ... where ...";
$connector->render_sql($sql, "id", "...");
}
However, when I execute the code, the client.php file is called, with no paramters. The response contains the nb. of rows ( ) and the I get an error from the Grid object:
Any idea where I’m doing something wrong?