Dynamic loading: posStart vs. start and failure to work

Hi, I’m still trying to get the dynamic loading to work with my grid.

I’m using the FrontBase DB so I wrote a custom DBDataWrapper to implement the dynamic selection query.

The problem seems to lie within the dhtmlxGrid object or the dhtmlXDataStore, whichever does the dynamic data loading.

My connector file is called clients.php and the maximum row per page is set to 25.

The first call to my connector with no parameter works perfectly. The xml returned contains the total_count value:

The 2nd call to the connector to fill the grid however fails. There is no “posStart” parameter set, instead there is a “start” parameter equal to the total_count value previously received. The “count” parameter is correct:

So what am I doing wrong?

Thanks for any hint.

Here is my client side code:

            var skin = 'dhx_skyblue';
            dhtmlx.image_path='includes/dhtmlx/imgs/';
            
            var grid_clients = cell_clients_list.attachGrid();
            grid_clients.setIconsPath(dhtmlx.image_path);
            
            grid_clients.setColumnIds("noClient,client_nom,rue,ville,province,fidTerritoire,territoire_nom,isActif");
            grid_clients.setHeader(["Client #","Name","# Street / Office","City","Province","fidTerritoire","Territory","Active"]);
            grid_clients.setColTypes("ro,ro,ro,ro,ro,ro,ro,checkdot");
            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', datatype:'xml' } ); 
            grid_clients.sync( clientsDataStore );

My script includes are:

<script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/dhtmlxcommon.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/dhtmlxcommon_debug.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxLayout/codebase/dhtmlxlayout.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxLayout/codebase/dhtmlxcontainer.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxCombo/codebase/dhtmlxcombo.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxForm/codebase/dhtmlxform.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxForm/codebase/ext/dhtmlxform_item_combo.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxTabbar/codebase/dhtmlxtabbar.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/dhtmlxgrid.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxDataStore/codebase/datastore.js"></script> <script src="dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxDataStore/codebase/datastore_debug.js"></script>

My connector code is:

[code]<?php
require_once(“includes/inc.php”);
require_once(“dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxConnector/php/codebase/grid_connector.php”);
require_once(“dhtmlxlib/DHTMLX Suite 3.0 Pro/dhtmlxConnector/php/codebase/db_frontbase.php”);

$posStart = 100;
if(isset($_GET[“posStart”])) $posStart = intval($_GET[“posStart”]);

$start = 100;
if(isset($_GET[“start”])) $start = intval($_GET[“start”]);

$count = 20;
if(isset($_GET[“count”])) $count = intval($_GET[“count”]);

dbhs();

$connector = new GridConnector($dbh->connection, “FrontBase”);
$connector->enable_log(“clients_log.txt”,true);
$connector->set_encoding(“utf-8”);

$connector->dynamic_loading($count); // top(x, y)

$sqlupdate = “update Client set noClient=‘{noClient}’, nom=‘{client_nom}’ , rue=‘{rue}’, adresse2=‘{adresse2}’, ville=‘{ville}’, email=‘{email}’, note=‘{note}’, province=‘{province}’, telephone=‘{telephone}’, fax=‘{fax}’, codePostal=‘{codePostal}’, fidTerritoire={fidTerritoire}, pays=‘{pays}’, isActif={isActif} where idClient={id}”;
$connector->sql->attach(“update”,$sqlupdate);

$where = “fidCompagnie = 1000000”;

if( $connector->is_select_mode() )//code for loading connector
{
//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);
$posStart = 0;
$pos = 0;
}

$sql = "select client.idClient, client.noClient, client.nom as client_nom, client.rue, client.adresse2, client.ville, client.email, client.note, client.province, client.telephone, client.fax, client.codePostal, client.fidTerritoire, territoire.nom as territoire_nom, client.pays, client.isActif from Client join territoire on client.fidTerritoire=territoire.idTerritoire where client.$where";    
$connector->render_sql($sql, "idClient", "noClient, nom(client_nom), rue, adresse2, ville, email, note, province, telephone, fax, codePostal, fidTerritoire, territoire_nom, pays, isActif");

}
else //code for other operations - i.e. update/insert/delete
{
$connector->render_sql($sqlupdate, “id”, “noClient, client_nom, rue, adresse2, ville, email, note, province, telephone, fax, codePostal, fidTerritoire, pays, isActif”);
}

?>[/code]

You should attach connector.js file to your page

Thanks for the quick reply!

I included connector.js to the included files but I get the same result.

brem