Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ashutosh Agarwal on Dec 04, 2007 05:05
open dhtmlx forum
Pagination in DhtmlxGrid

Hi,
I am using pagination in dhtmlxGrid. I want to pass the page number while making the request for new set of records. How i can achieve that.

    var baseUrl = "http://localhost:10080/haviNonReceipe/";
    var requestString1 = baseUrl + "drawQuantities.htm?action=listDrawQuantitiesAutoLoading" + "&uniqueParam=" + Date.parse(new Date());

    mygrid.setXMLAutoLoading(requestString1,10); // for request for the page.
var requestString = baseUrl + "drawQuantities.htm?action=listDrawQuantities" + "&uniqueParam=" + Date.parse(new Date());
mygrid.loadXML(requestString); // for first time request.

Also I have found that when user select page 3 from from 1. The grid makes a request for page 2 first and then page 3. I dont want this thing to happen.

Regards,
Ashutosh Agarwal.
Answer posted on Dec 04, 2007 06:07
>>I want to pass the page number while making the request for new set of records. How i can achieve that.

There is no API for such functionality , but you can modify loadXML method in dhtmlxgrid.js which is key point for all XML requests.
this.xmlLoader.loadXML(url+""+s+"rowsLoaded="+this.getRowsNum()+"&lastid="+this.getRowId(this.getRowsNum()-1)+"&page="+this.currentPage);


>>Also I have found that when user select page 3 from from 1. The grid makes a request for page 2 first and then page 3. I dont want this thing to happen.
This is default behavior, in paging mode grid uses linear buffer, so it can't access record without preloading intermediate ones.