Saturday, December 18, 2010

DHTMLXGrid subgrid paging

To create paging in subgrid, one must create a row in the table.
The example below put up paging as footer.
The enablePaging should only be call when loading data.
This is because the grid is not created yet, therefore the div did not exists yet.

mygrid.attachEvent("onSubGridCreated",function(subgrid, id){
//collapse all other subgrid
//notice the div is given the unique id
//the trailing #cspan to set colspan of the other column to merge with 1st column
// therefore, the #cspan have to match your column count-1
subgrid.attachFooter("<div id="subgrid_h" + id + "" style="width:100%;"></div><div id="subgrid_f" + siteid + "" style="width:100%; height: 20px;"></div>,#cspan,#cspan,#cspan");

subgrid.load("" + siteid,function() {
subgrid.enablePaging(true, 10, 10, "subgrid_h" + siteid, true, "subgrid_f" + siteid);
subgrid.callEvent("onGridReconstructed", []);
}, "json");

return false; // block default behavior



thx was very helpful. What is this siteid variable that you are using ?

JAVA Helping Hands said...

hai in my program i loaded data from xml file using load() and performing paging .
i have 8 rows and i want to see two rows for each page it is showing page 1 and page 2 by using changePage(),

but after page 2 it is stucking there it even not showing an alert message also.

i am using setTimeout() to go to page 2.... from there to page 3 but it stuk there itself....

i have also tried onpagechange event also but not familiar with so facing some problems

is there any other way to perform paging automatically using events......

please help.............
thanks with regards.........