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.

Parents
No Data
Reply
  • 5105
    Verified Answer
    Offline posted

    Hi Flavio,

    I noticed that you are trying to select and expand to a node with two separate calls. I actually noticed that we've not documented the second parameter of the expandToNode method which was added in 2013.1 is boolean and flags whether to select the node you're expanding to. You can replace your logic by calling:

    $("#tree_id_1").igTree("expandToNode", startingNode, true);

    Let me know if the node still remains unselected when you do that.

    Thank you for using the Infragistics forums!

Children