Dynamic Loading firing two loading events

I’m working the the xGrid, pro, and using dynamic loading and server side sorting and custom filters. When a filter is chosen, I post back to the server to get the new data. If the data set is more than the current size of the dynamically loaded row count (e.g. mine loads 27 rows at a time)… everything works great and only onXLS is fired (e.g. 50 rows returned works great).

If the data set returned is less than the size of the row count, both onXLS fires and onDynXLS fires, and the onDynXLS appears to go back to the server to re-retrieve the data again (e.g. like 20 rows were returned).

My two handlers are as follows… where showLoadingPopup() just shows a div with a ajax wait cursor (spinning circle) in it

[code]mygrid.attachEvent(“onXLS”, function(){
return showLoadingPopup();

		mygrid.attachEvent("onDynXLS", function(start,count){
			return showLoadingPopup();

This is the code for the filter:

[code]function filterBy()

	    var filter1 = document.getElementById("fltfilter1").value;
    	   var activeFilters = "&filter1=" + escape(filter1);
    	    var newQ= gridQString;   // Get the original query and string used to load the grid
            if (sortColumn.length > 0)
	    	newQ+= "&orderBy=" + sortColumn;
	    if (sortDir.length > 0)
	    	newQ+= "&direction=" + sortDir;
	    mygrid.clearAndLoad(newQ+ activeFilters);
	    return false;

It also appears to add a duplicate row of the last row on the screen (if there is only 1 row, there will now be 2… if there were 6 rows, there would be 7, and 7 would be a duplicate of 6)…

Any ideas on fixing this? (In IE6, it seems to just be a recurring loop that never ends, it constantly re-loads the page)…

I also have some code that iterates the rows (I have a checkbox in the filter row that checks all the check boxes in the grid in the same column)… it skips the next to the last row… so like
rows[0], rows[1], and rows[2] point to row 1, row 2, and row 4, respectively.

Very weird… hope that helps narrow down the issue. This same problem occurs in IE 6, FF 3.6, and IE 8.

If count of loaded rows is lesser than necessary to cover visible part of grid - second request to server will be generated and onDynXLS called.

Also, be sure that your server code process posStart attribute correctly and returns response with valid rows@pos ( incorrect values may produce row duplication )

The problem is this… I am using server-side filtering, and so if someone filters the grid and it returns fewer than 27 or whatever rows that are displayed, then when I clear and load the grid it still tries to continually poll the server for additional rows… which is incorrect… so here’s the method to reproduce, and I disagree that this should be by design:

If you enableSmartRendering(true) and the count is 27 (in my case), then your request to the server returns LESS than 27 TOTAL rows… (e.g. I do SomeJavaServlet.do?filtercriteria=blah and it returns a total of fewer than 27 rows, it goes back and asks for more, and when it doesn’t return any more, it goes back and asks for more again, ad infinitum)… at least that is what appears to be occuring. I generate the rowId dynamically server-side by ordinal (e.g. row 1 = rowId 1, etc)…

Is that the expected behavior? If dynamic loading is enabled and the total rows returned for the entire dataset is < the count, it will just continually loop and never stop?

Second, with the rowIds… should I be using a surrogate key or something?


Figured it out. The xml element was returning with a total_count greater than the actual number of rows returned. This is now fixed.