Categories | Question details Back To List | ||
Refreshing XML from server I am not using pro version of dhtmlxgrid and am loading xml that is returned from a servlet depending on the users request. I load the xml by using: reply = httpObj.responseXML; mygrid.parse(reply); The first time works perfectly, however the second/third etc time the information in the grid stays the same. Is there a way to remove the grid and create a new one, or refresh the grid? But the user selects the amount of columns required and refreshing it might leave the same amount of columns. Answer posted by Support on Jul 10, 2008 05:45 You can preserve grid structure and only clear data part of grid by grid.clearAll(); function reload(xml){ grid.clearAll(); grid.parse(xml); } Also dhtmlxgrid support updateFromXML method, but it works only with urls and will not work with XML object, as parse method. Answer posted on Jul 10, 2008 11:20 Is it possible to remove the structure aswell as the data so that a whole new grid is created from scratch and the old one is removed? Not the most efficient but the user would enter the data they want and it can sometimes contain different amount of columns. Something like: function reload(xml){ grid.remove(); grid.parse(xml); } Answer posted by Support on Jul 11, 2008 01:32 The clearAll has an optional parameter grid.clearAll() // removes data only grid.clearAll(true) // removes data and structure, events and modes still preserved Answer posted on Jul 11, 2008 11:45 I tried it, but it wouldn't reload the information properly and left an empty shell of the table on the page. I have managed to get around it though, if your interested, by clearing the div fully before reloading the information by using document.getElementById("DIVNAME").innerHTML=""; Works a treat. Answer posted by Support on Jul 14, 2008 02:10 If you want to fully remove grid, it has a native method grid.destructor(); It will remove any traces of grid ( the existin grid object will not be usable after it anymore ) |