Announcement

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

    Tree.openFolder() Doesn't Appear To Work

    I was hoping to force a folder TreeNode to open when a user single-clicks it, by calling Tree.openFolder(TreeNode) which in turn would dispatch a onFolderOpened() event but this does not seem to work. My test case below does call the openFolder() method on a single click but I never receive the onFolderOpened(). Should this work or am I interpreting it incorrectly? Thanks!

    Code:
        class TreeNodeClickHandler implements CellClickHandler
        {
            protected IMODTreeGrid treeGrid;
            
            public TreeNodeClickHandler(IMODTreeGrid treeGrid)
            {
                this.treeGrid = treeGrid;
            }
            
            public void onCellClick(CellClickEvent event)
            {
                System.out.println("onCellClick() called...");
                
                if (event.getRecord() instanceof IMODTreeNode)
                {
                    IMODTreeNode treeNode = (IMODTreeNode) event.getRecord();
                    
                    if (treeGrid.getData().isFolder(treeNode) && !treeGrid.getData().isOpen(treeNode))
                    {
                        treeGrid.getData().openFolder(treeNode);
                    }
                }
            }
        }
    
        class TreeNodeFolderOpenedHandler implements FolderOpenedHandler
        {
           protected IMODTreeGrid treeGrid;
            
            public TreeNodeFolderOpenedHandler(IMODTreeGrid treeGrid)
            {
                this.treeGrid = treeGrid;
            }
            
            public void onFolderOpened(FolderOpenedEvent event)
            {
                System.out.println("onFolderOpened() called...");
                
                if (event.getNode() instanceof IMODTreeNode)
                {
                    expandFolder(treeGrid, (IMODTreeNode) event.getNode(), false);
                }
            }
        }
Working...
X