Hi
i have created a Treepanel using a treestore. i need to reorder [move the child node up and down within the parent] on click of a button. is this possible ???

i have been trying to achive the same by reomiving the seleted node and insert the same node again
but the problem am facing is when i remove a node the code written after is not executing, even thoug the node gets deleted from the treepanel but a new node is not being added/inserted when debuged it
I tried using a button upArrow

upArrow
.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
BeanModel selItem = treePanel.getSelectionModel().getSelectedItem();
BeanModel parent = treePanel.getStore().getParent(selItem);
List<BeanModel> childrens = treePanel.getStore().getChildren(parent, true);
for(BeanModel child : childrens){
treePanel.getStore().remove(child); // this works well for the nodes not being selected, for selected node it throws Targetinvocationexception.
}
treePanel.getStore().add(parent, childrens, true); // Doesnt get executed at all
}
});

let me know if any this is wrong or suggest me a proper solution for moving the children within the parent and i have to have this funcionality on click of a button.


Untitled.png