Is there any event triggering when tree fully loaded?
I have read documentation a few times and as I understood there is no event which can be triggered when the tree is fully loaded. It would be nice to have such event.
Yeah. Sorry, I just not understood from name that this event is triggered when the tree is loaded. But there is one issue. I would like to trigger similar event when the tree is rebuilt after drag-and-drop any node. Is it possible?
The tree.refresh event is triggered when the tree is rendered. So, also after drag-and-drop. I see that this event is not documented yet.
The tree.move is called before the move.
Does this help?
Yes! Thank you! You are right there is no description of event tree.refresh in documentation.
Could you please send me a sample how we can use the tree.refresh?
thank you in advance.
You can use tree.refresh like this:
$('#tree1').on('tree.refresh', function() {
// This function is called after the tree rendered
});
I personally never use this event. Depending on your use case there are other options:
- tree.init which is called after the tree data is loaded.
- onCreateLi to customize the rendering of the tree.
Why when i re draw the tree the function of the tree did not work?
How exactly do you redraw the tree?
$('#tree1').tree({ data: data, autoOpen: false, dragAndDrop: true, load_on_demand:true, cache: false, closedIcon: '<i class="fa fa-chevron-right " style="margin-left:3px" ></i>', openedIcon: '<i class="fa fa-chevron-down " style="margin-left:2px" ></i>' });
And after that you connect the tree.refresh event?
In this case the tree.refresh will not be fired because the tree is rendered before you connect the event.
I think it will be fired when you do drag-and-drop or when you load a node on demand.