Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    In TreeGrid child nodes are not getting checked/unchecked on parent check/uncheck

    In TreeGrid, i'm using 1st column as a checked tree nodes.
    On parent checked node click, it doesn't check/uncheck its child node.

    Please help to fix this.

    Thanks in advance,
    Vikas

    #2
    It is not documented as doing so. If you want hierarchical selection you need to implement it via CellClick and similar events - it's not built-in yet.

    Comment


      #3
      I'm trying to implement this through 'FolderClickEvent' but did not get any method to select/unselect nodes.
      Code:
      import com.smartgwt.client.widgets.tree.*;
      import com.smartgwt.client.types.*;
      import com.smartgwt.client.widgets.tree.events.*;
      
      import com.starent.ipms.client.common.main.*;
      
      public class STreeGrid extends TreeGrid implements FolderClickHandler
      {
      	public STreeGrid()
      	{
      		super();
      		setSelectionAppearance(SelectionAppearance.CHECKBOX);
      		addFolderClickHandler(this);
      	}
      
      	public void onFolderClick(FolderClickEvent event)
      	{
      		Tree tree = getTree();
      		TreeNode node = event.getFolder();		
      		TreeNode children[] = tree.getChildren(node);
      		for(int i=0; i<children.length; i++)
      		{
                          //here I want to select/unselect children, but did not get any method to do so.
      		}
      	}
      }

      Comment


        #4
        Done by following way.
        Code:
        	public void onFolderClick(FolderClickEvent event)
        	{
        		Tree tree = getTree();
        		TreeNode node = event.getFolder();
        		ListGridRecord tmpRecords[] = getSelection();
        		boolean isSelect = false;
        		for(int i=0; i<tmpRecords.length; i++)
        		{
        			if(node.equals(tmpRecords[i]))
        			{
        				isSelect = true;
        				break;
        			}
        		}
        		TreeNode children[] = tree.getChildren(node);
        		if(isSelect)
        		{
        			selectRecord(node);
        			selectRecords(children);
        		}
        		else
        		{
        			deselectRecord(node);
        			deselectRecords(children);
        		}
        	}

        Comment

        Working...
        X