treegrid update data

Is there another method to reload data into the treegrid other than:

mygrid.clearAll(); mygrid.loadXML("data.xml");

I have a toggle button that changes a value from my database using ajax, but after the change I need to be able to display it. It would be a lot nicer not to have to empty the grid and reload everything. Can this be done? Are there any examples?

You can use updateFromXML() method


With a message at the top of that API call saying:

I didn’t even try. Per your suggestion, I did try…it doesn’t give me an error, but it doesn’t seem to update.

Also, when setting the del_missed attribute to true it deletes all rows except for 1. I have verified that the XML is correct, and it is. It is the same file I am loading in at the beginning, I just want to refresh it.

Any more ideas?

Unfortunately there is no more ideas. updateFromXML() works well when you update only one branch. So you can try to call it several times

I’m not sure what you mean by updating only one branch. Do you have any examples of this? I am just using the function and feeding it with the same XML file I am using when initializing the treegrid.

Any examples on how to update just one branch?

updateFromXML was designed for plain grids, so it is limited in case of TreeGrid, you can’t move row from one branch to another for example.

if you need to update only content of rows (not add|delete rows) you can use updateFromXML safely, returning xml in plain format ( not hierarchy ). TreeGrid will update existing rows with new data.


Updating what I already had loaded was all I wanted to do.

Turns out my issue was with my XML. None of my rows had an ID attribute for them. Once I added an ID attribute in the correct place updateFromXML works perfectly.

Unfortunately, I wasn’t getting any javascript error and any message telling me that I had a problem. It just simply wasn’t working.

All is fixed now.