Hi
What is the simplest way to swap two entries in a treeview-component?
At the moment I get the dataset of the treeview (Servoy Extra Compontent) and swap the two entries inside the dataset. Unfortunately the function treeview.refresh() seems not to reload the dataset. I have to set the dataset again and refresh it. It works and looks a little like this.
var dsTree = elements.treeview.jsDataSet;
swapEntries(dsTree, row1, row2); // Swaps the place of row1 with row2
elements.treeview.setDataSet(dsTree);
elements.treeview.refresh(true);
Do I realy have to call setDataSet() again, or is there a simpler way with refresh, reload?
I also want to show the leaves opened as before the swap. But refresh(true) or refresh(false) will make no difference. So if I do it like in the samplecode, the treeview is completely colapsed after setDataSet() and refresh().
I made a workaround with two functions. One does remember witch leaves were openend with treeview.isNodeExpanded() and another does expand the ones that shoud be expanded with treeview.expandNode(key). But this is very expensive, when the tree is large.
Has anyone experience with large treeviews an has some good practices for it?
Does refresh(true) work as expected?
We use:
Servoy Version: 2024.3.6.3949_LTS
Servoy Extra Compontent: 2024.3.2
thanks
Gregory