dhtmlxGrid reloading XML data after doOnLoad()

Hi,

I have full version of DHTMLx purchased for my work , and am having some issues.

I am loading the grid from a server-side php file that spits out XML. The problem is that I want to pass a GET parameter to the php executable (to change the XML output) , then rebind the grid.

Right now, the code looks like

The page loads fine, and the unfiltered xml data loads fine from trollGet1.php. The problem is that when I click the button (on the event handler) , nothing happens to the grid. I am expecting the XML data to get reloaded to the grid , populated by the trollGet1.php script with the HTTP GET filter, but it won’t reload.

Nothing happens.

Please advice… all my other event handlers are working , including populating a dhtmlXEditor from an XMLHTTPRequest, but as to why I can’t reload the grid with fresh data, this remains a mystery to me.

I’ve tried all sorts of functions from the form buttom event handler, including dhxGrid.clearAll(), dhxGrid.clearAndLoad(), etc etc but none of them actually reload the grid with new data . Please advise.

Thanks

Actually let me clarify my post, I left an important detail out of the code… I am calling dhxGrid.loadXML() twice… once from the doOnLoad() function. The first call, from the doOnLoad() function, there the loadXML call works fine.

The problem is when I call the dhxGrid.LoadXML() from the Form button Event handler. There it does nothing, and that is the mystery.

The page loads fine, and the unfiltered xml data loads fine from trollGet1.php. The problem is that when I click the button (on the event handler) , nothing happens to the grid. I am expecting the XML data to get reloaded to the grid , populated by the trollGet1.php script with the HTTP GET filter, but it won’t reload.

Nothing happens.

Please advice… all my other event handlers are working , including populating a dhtmlXEditor from an XMLHTTPRequest, but as to why I can’t reload the grid with fresh data, this remains a mystery to me.

I’ve tried all sorts of functions from the form buttom event handler, including dhxGrid.clearAll(), dhxGrid.clearAndLoad(), etc etc but none of them actually reload the grid with new data . Please advise.

Thanks

Nevermind, I spoke to soon… can’t believe I’ve spent hours on this and just figured it out in the last 5 mins…

I had to reinstantiate a fresh dhxGrid object then rebind it to its container…

This involved changes to the button press function to re-initialize everything relating to the datagrid …

While your final solution is fine enough, normally to reload grid with new data you need only to have those two lines

dhxGrid.clearAll();
dhxGrid.loadXML(“php/trollGet1.php?urlFilter=filterstring2”);

First will clear existing data in grid, second will load new data.

Calling loadXML while data already exists in grid ( as it was in your original code ) can lead to different results, based on existing configuration, but it will not cause full data reloading.