Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2048
Strange double igtreerendered
posted

Hi,

I got a strange behavior on the igTreeRendered event.

Situation:
I have 2 treeModels and I would like to intercept the rendered event for each one of them, to set the default starting node, which should be selected and on which the branch should be expanded to.
$(document).delegate("#tree_id_1"i, "igtreerendered", function (e, args) {
                var startingNodeIndex = 123;
                var startingNode = $("#tree_id_1").igTree("nodesByValue", startingNodeIndex);
                $("#tree_id_1").igTree("select", startingNode);
                $("#tree_id_1").igTree("expandToNode", startingNode);
});

$(document).delegate("#tree_id_2"i, "igtreerendered", function (e, args) {
                var startingNodeIndex = 456;
                var startingNode = $("#tree_id_2").igTree("nodesByValue", startingNodeIndex);
                $("#tree_id_2").igTree("select", startingNode);
                $("#tree_id_2").igTree("expandToNode", startingNode);
});

Problem:
I can see the first tree exactly expanded, but not selected, while the second one is correct. It seems to not be the scond calling of the select node method to deselect it, but probably it's the rendered event...
I tried to simply put one tree and it works right. This probelm occours just with more than one tree, and only on the first one...and the really problem is that I have to show that node selected..

Thanks

Flavio M.