I have created some functionality that allows a user to re-order the children of a node in a treeview control. Here is how it works:
All these works without error (YEAH!) and the child nodes are re-loaded in the newly edited order. But, if I click the parent node that has just had its children re-ordered, the children suddenly revert back to their original order. They are not being reloaded from the database (the database now has them in the correct order so, they would re-load in the correct order anyway, if that were true). So, it seems like there is a legacy of the old order being stored in memory, and that is somehow being re-applied.
I tried putting a "treeview.commitChanges()" command directly after the line that clears the child nodes, and another "treeview.trackChanges()" command directly after that but, that had no effect.
How can I ensure that I have truly cleared the memory of the child nodes in the old order?
Thanks for any help you can provide.
- The user right-clicks a node to launch a context menu
- The user selects "Reorder subordinates" from the context menu
- A RadWindow launches a "dialog box" that contains and unordered list of the children of the clicked item. Each list item has a check box next to it. The user can select the children they want to re-order and use "Up" and "Down" buttons to move them up and down the list. When the user clicks "Commit Changes" button, a comma seperated list of the items, in their new order is returned to the parent page, which does an AJAX callback to the database and updates the order of the children.
- On the client side (javascript), after the AJAX callback, the following code runs, and updates the parent node in the treeview:
//get the treeview, and get the node
treeview.trackChanges();
node.collapse();
node.get_nodes().clear();
node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.WebService);
node.expand();
treeview.commitChanges();
All these works without error (YEAH!) and the child nodes are re-loaded in the newly edited order. But, if I click the parent node that has just had its children re-ordered, the children suddenly revert back to their original order. They are not being reloaded from the database (the database now has them in the correct order so, they would re-load in the correct order anyway, if that were true). So, it seems like there is a legacy of the old order being stored in memory, and that is somehow being re-applied.
I tried putting a "treeview.commitChanges()" command directly after the line that clears the child nodes, and another "treeview.trackChanges()" command directly after that but, that had no effect.
How can I ensure that I have truly cleared the memory of the child nodes in the old order?
Thanks for any help you can provide.