Hi folks,
Would like to use the TreeList widget in one of my nodes. As the documentation suggests, the current functionality is rather limited. For example there are no functions for dynamically adding/removing children in the tree.
Just wondering now what is the best way to accomplish this. For example when I look at the code of the Link-node, I see that the view is redrawed very frequently:
treeList = $("<div>")
.css({width: "100%", height: "100%"})
.appendTo(".node-input-link-row")
.treeList({})
.on('treelistitemmouseover',function(e,item) {
if (item.node) {
item.node.highlighted = true;
item.node.dirty = true;
RED.view.redraw();
}
});
...
treeList.treeList('data', flows);
When I want to add/remove children in the tree, do I have to implement it with the following steps?
- When the user clicks the 'add' or 'remove' button, I have to update my
treeAsJsonString
variable. - Then I update the tree widget content via
treeList.treeList('data', treeAsJsonString);
. - Then I need to call
RED.view.redraw
?
Can RED.view.redraw
be called to show small updates, without messing up the performance? It is not clear to me whether it redraws the entire view, or it does only update the deltas somehow ...
Thanks !!!
Bart