Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Manhar Trivedi on Feb 11, 2009 13:37
open dhtmlx forum
Custom Pagination in dhtmlxGrid

Hi,

I have a dhtmlxGrid(Professional) which retrieves 500 Records(50 Records * 10 Pages) from server having over a lakh of record. Every time the user clicks on NEXT the server sends
1)another set of 500 Records
2) The "Current pointer" to the records eg Records from 1001 to 1500.

My grid custom pagination looks like

mygrid.setPagingTemplates("Pages --> <span onclick='fetchPreviousPagesFromServer();'> PREVIOUS</span> | [current:0:] | [current:+1:] | [current:+2:] | [current:+3:] | [current:+4:] | [current:+5:] | [current:+6:] | [current:+7:] | [current:+8:] | [current:+9:] | <span onclick='fetchNextPagesFromServer();'>NEXT</span> ","");

I want to use the "Current Pointer" information to display the paging.So that if user moves from first set of 500 records to second set of 500 records the paging numbers should change to 11|12|13|14|15|16|17|18|19|20.
            
I tried following
http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_paging.html#grid_art_custpaging
but it didnt showed up the desired result.

Thanks
Answer posted by Alex (support) on Feb 12, 2009 05:25

You can try to use the following template:

grid.enablePaging(true,50,10,"pagingArea",true,"recinfoArea");
grid.init();
mygrid.setPagingTemplates("Pages--> [prevpages:PREVIOUS:] [current:0]|[current:+1]|[current:+2]|[current:+3]|[current:+4]|[current:+5]|[current:+6]|[current:+7]|[current:+8]|[current:+9] [nextpages:NEXT:]","")

Answer posted by Manhar on Feb 19, 2009 08:24

When using the template style stated above every time the Client browser gets next set of 500 records(lets say from record number 501 to 1000), the paging style is still the same way i.e 1|2|3|4|5|6|7|8|9|10 (Because client only knows of 500 Records, though the database has over 1 lakh record it only sends only 500 Records).

What i want instead is to replace the "current" variable in the mygrid.setPagingTemplates with the current pointer obtained from server. So in lets say if client receive 501 to 1000 records the "pointer" value will be equal to 11.And the paging template would look like.

mygrid.setPagingTemplates("Pages--> [prevpages:PREVIOUS:] [pointer:0]|[pointer:+1]|[pointer:+2]|[pointer:+3]|[pointer:+4]|[pointer:+5]|[pointer:+6]|[pointer:+7]|[pointer:+8]|[pointer:+9] [nextpages:NEXT:]","")

But as per the dhtmlx Documentation the setPagingTemplates function only supports variables like "current","prevpages" and other few.

Can i make this thing work ?

Thanks

 

Answer posted by Support on Feb 19, 2009 09:31
a) the "current" in above template related to currently selected page of the grid, it doesn't related to data loaded from server.
b) while there is no way to use custom pointer in template, you can define your custom function which render paging area as you wish.

grid._pgn_custom=function(page,start,end){
        this.pagingBlock = "any custom html here";
}
grid.setPagingSkin("custom")


inside custom  html you can use link with grid.changePage(some); commands