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
205
◦How to make the checkbox checked while loading igTree
posted
    • How to make the checkbox checked while loading igTree?
    • How to add a flag in the igTree data source, so that with the help of that flag, we can check the checkboxes on loading the tree?
    • How to get the current tree structure (which all nodes are opened, which node is selected in the heirarchy, etc.)? This is to rebind the tree.
    • How to get all nodes of igTree?

Parents Reply
  • 80
    posted in reply to Konstantin Dinev

    Hi again.
    I try to use the solution that you sent me,
    http://es.infragistics.com/community/forums/t/70543.aspx , but the problem continued, i implemented this:

    $("#tree").igTree({

        singleBranchExpand: true,

        dataSource: data,

        dataSourceType: "json",

        checkboxMode: "triState",

        pathSeparator : ".",

        rendered: function (evt, ui) { TreeEstado(evt, ui) },

        bindings: {

            textKey: "Text",

            valueKey: "Value",

            childDataProperty: "Submodulos",

        },
    });

    The TreeEstado function is:

    function TreeEstado(evt, ui) {
        var nodes = ui.owner.uncheckedNodes();
        for (var i = 0; i < nodes.length; i++) {
            node = nodes[i];
            if (node.data.Estado == true) {
                $("#tree").igTree("toggleCheckstate", node.element) // toggle the checkState of each node
            }
        };
    }

    In this function Estado is the flag that indicated whether or not an node is checked or is unchecked. Estado is a field in my datasource.

    The final result in the tree is not correspond to the datasource, i explain, some nodes in the tree are with checked mark but in the datasource Estado is false and viceversa.

    Thank you for you help

Children