Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jonathan on Jun 26, 2008 09:17
open dhtmlx forum
Grid Paging

Question: Grid Paging
Grid Paging
Jonathan, posted: Jun 25, 2008 14:27 | Direct link: http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=3796
When paging is it possible to force the refresh of the data from server when using XML? I have a server side script that obtains the XML from a database. If someone else changes the data on a previous page and the grid is paged back to that page it does not refresh the data from the server. It displays the data exactly as it was before moving to the next page.

AnswersSupport, posted: Jun 26, 2008 01:50

The grid doesn't reload already loaded data from server when current page changed.
You can use next code to implement necessary behavior.

mygrid.attachEvent("onBeforePageChanged",function(page){
mygrid.updateFromXML("some.url?page="+page);
return true;
});

In such case, each time when page changed, call to server side will be executed , which can load updated info for necessary page.



Your above solution doesn't work because onBeforePageChanged is for the current page. It doesn't reference the page I'm changing to. I tried onPageChanged, but that makes 2 calls to the server every time I change a page to update the data. I am using the toolbar for the page navigation so the number of results returned per page can change so I have to also take that into account. What's the purpose of prevent IE caching if it's going to cache the page anyways? I will have numerous users working on the same set of records and I need the page data to be current and not cached.

Also, the enableOrderSaving and loadOrderFromCookie calls are not working properly. The column ordering is not saved when the page is refreshed.
Answer posted by Support on Jun 26, 2008 10:15
>>Your above solution doesn't work because onBeforePageChanged is for the current page
Sorry for inconvenience, was a my typo.
onBeforePageChanged  sends two parameters, existing page and one which will be loaded, code need to be updated as

    mygrid.attachEvent("onBeforePageChanged",function(current,page){

>>What's the purpose of prevent IE caching if it's going to cache the page anyways?
This feature is usefull when you have dynamic data source, for example data cached in users's browser after first visit to the page, after that data was updated, and on next visit user need to get new, updated data, not the cached one.
You can disalble feature by using
    grid.preventIECaching(false);
it will not have any other sideeffects