RESOLVED: Dynamic Paging - Problem

Hi Folks,

I am trying to implement your grid using dynamic paging with the toolbar paging style. Needless to say, I’m having a heck of a time.

When I attach the onBeforePageChanged callback, I am having some interesting problems. My intention is to capture the page that the user wants to go to (because I need to add/modify some parameters in the URL, however, the event fires twice.

I’m using the toolbar option of the grid’s paging options

Workflow:
I load up the grid with data using loadXML call with a webpage (the webpage is returning the correct data), I know this because I’m using Fiddler.

The first time it fires my callback, and I’ve clicked Page 5 from the dropdown, the first parameter has 1 for a value, the second parameter has 5 for a value. This first call is generated from _pgn_createToolBar method of the dhtmlXGridObject.

Then, my callback is called again, and the first parameter has 5 for a value, and the second parameter has 1 for a value. This second call is generated from the clearAll method of the dhtmlXGridObject. Which was called from _parseHead method of dhtmlXGridObject, which was called from _process_xml method of dhtmlXGridObject, etc. etc. etc.

Now, if I put a condition around the code in the onBeforePageChanged callback, like so:

if (this.currentPage > 1) {
// modify the url and set this.xmlFileUrl = to the modified url
}

I have to select the page twice in a row to get the data to show…

I can’t get the grid to perform correctly, and I can’t use this control unless I can get past this, and I’ve been chasing this for two days. Please help.

I am having this exact same problem.

I figured out that it’s because my header is being dynamically generated via my XML instead of being set in the javascript. If I change my header to load through the javascript, the onBeforePageChanged event only gets called once. I hope they have a solution for this because I really don’t want to build out my header in JS.

Rachel

If you are loading data from XML dynamically, be sure that only first XML portion contains HEAD section, all subsequent calls must return data part only

In your case configuration is loaded each time, and as result, instead of data adding - grid fully reconstructed each time ( reaction of “head” in the XML )

Thank you for that!!!

It works fine now, except when I get to the last page, then it goes into an infinite loop, calling the server repeatedly for data.

Any ideas on this?

It seems that “total_count” value which was provided initially was wrong.
Grid expects to have “total_count” value of rows, so it will continue to request rows if lesser amount of rows was returned from server side.

I was away for a few days, sorry for not responding back, this is resolved…Thanks for your help…