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
140
WebTree behaving like a radio-button group?
posted

Hi!

Is it possible to allow only one selection on WebTree?  I have a pretty simple hierarchical data that needs to be shown to the user in tree-view manner (only 1 level deep).  I also need to let the user to check any node, so checkboxes have been enabled.  However, upon checking a node, I would like all other nodes to be un--checked.  Is this possible?

I wrote the following code to iterate through the tree and un-check any node that is NOT the node that's being checked but the code reports "out of memory" error.  It sounds like some sort of stack-overflow-type message and I think that for some reason the handler is getting called too many times.  The tree is very small (just a few nodes in Level-0, and about 5-10 nodes in Level-1).

Can someone please point out what the problem is in my code below.  Thanks for any help in advance!

function UltraWebTree_NodeChecked(treeId, nodeId, bChecked)

{

    var tree = igtree_getTreeById(treeId);

    var parents = tree.getNodes();

    for(n in parents)

    {

        var parent = parentsNo;

        var children = parent.getChildNodes();

        for(m in children)

        {

            var child = children[m];            if(child.Id != nodeId)

            {

                child.setChecked(false)

            }

 

        }

    }

}

Parents Reply Children
No Data