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
40
No Client side event on Uncheck
posted

My tree is defined as:

 <ignav:UltraWebTree
                ID="OrganizationalUnitTree"
                WebTreeTarget="HierarchicalTree"
                CheckBoxes="true"
                runat="server">
                <ClientSideEvents NodeChecked="TreeNodeChecked" />
</ignav:UltraWebTree>

 And the script is:

function TreeNodeChecked(treeId, nodeId, bChecked)
{
    var selectedNode = igtree_getNodeById(nodeId);
    var childNodes = selectedNode.getChildNodes();

    if (bChecked)
    {
        for (n in childNodes)
        {
            childNodesNo.setChecked(bChecked);
        }
    }
}
 

Shouldnt this get an event when I uncheck a checkbox? Whenever I uncheck a checkbox, I want all the children unchecked as well. 

Parents
No Data
Reply
  • 280
    posted

    Use below code, it works fine. 

     

    function TreeNodeChecked(treeId, nodeId, bChecked)
    {
        var selectedNode = igtree_getNodeById(nodeId);
        var childNodes = selectedNode.getChildNodes();

        if (bChecked)
        {
         selectedNode.setChecked(true) ;//this is for root node
     

           for (n in childNodes)
            {
                childNodesNo.setChecked(true);
            }
        }

    else

    {

    selectedNode.setChecked(false)

            for (n in childNodes)
            {
                childNodesNo.setChecked(false);
            }
     }
    }
     

Children