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
330
Checking all child nodes with ManualSmartCallback
posted

Hi Guys,

 I'm struggling a bit here with the WebTree.  I'm trying to get it to expand and check all nodes when a node is checked.  (Expanding of children nodes isn't too important, but would be nice).

 I've seen the thread "WebTree Check All Child Nodes With Demand Load" (https://es.infragistics.com/community/forums/f/retired-products-and-controls/16495/webtree-check-all-child-nodes-with-demand-load), but didn't find an answer there.

I've set up a clentside NodeChecked event, Tree_NodeChecked, which goes roughly like this...

function Tree_NodeChecked(treeId, nodeId, bCheck)
{
  node = igtree_getNodeById(nodeId);
  nodeGuid = node.getDataKey();
 
  if( bCheck == true )
  {
    // Do my stuff
    Load_Model( nodeGuid );
    
  
  // Expand the node
    node.setExpanded(true);
   
    // recursively tick/check child nodes
    var ChildNodes = node.getChildNodes();
   
    if( node == null || ChildNodes.length == 0 )
    {
      // Node has no children, do nothing.
    }
    else
    {
      for( ii = 0 ; ii < ChildNodes.length ; ii++ )
      {
        ChildNodes[ii].setChecked( true );
        Tree_NodeChecked( treeId, ChildNodes[ii].Id, true);
      }
    }
  }
  Else
  {
    // Do my stuff
    Delete_Model( nodeGuid );
  }

}

However, it only seems to work with childnodes that have been pre-loaded in (those that I expand, then un-expand).

Anybody have any advice?

Parents Reply Children
No Data