SmartGWT TreeGrid leaf / child nodes do not show folder icon to expand them

I have a requirement for getting child entries of a node tree when it is expanded using the "+" icon in a folder. If any particular node has no children, the + sign should disappear. This requirement is similar to what is indicated in the link.

But some how it does not work for me. Only the parent node shows the folder, and the child nodes do not have a folder by default. Below is the code I'm using. I copied the code from the link above. The only change is replacing the data source with tree nodes.

public void onModuleLoad ()
    {
        Tree adminTree = new Tree ();
        adminTree.setID ("adminTreeId");
        adminTree.setModelType (TreeModelType.PARENT);
        adminTree.setRootValue ("/");
        adminTree.setAutoOpenRoot (true);

        TreeGrid adminTreeGrid = new TreeGrid ();  
        adminTreeGrid.setWidth (500);  
        adminTreeGrid.setHeight (400);  
        adminTreeGrid.setShowOpenIcons (false);  
        adminTreeGrid.setShowDropIcons (false);  
        //adminTreeGrid.setClosedIconSuffix ("");  
        adminTreeGrid.setAutoFetchData (true);  
        adminTreeGrid.setData (adminTree);  

        TreeNode treeNode1 = new TreeNode ();
        treeNode1.setTitle ("Node 1");
        treeNode1.setID ("node1");

        TreeNode treeNode2 = new TreeNode ();
        treeNode2.setTitle ("Node 2");
        treeNode2.setID ("node2");

        TreeNode treeNode3 = new TreeNode ();
        treeNode3.setTitle ("Node 3");
        treeNode3.setID ("node3");

        TreeNode treeNode4 = new TreeNode ();
        treeNode4.setTitle ("Node 4");
        treeNode4.setID ("node4");

        adminTree.add (treeNode1, "/");
        adminTree.add (treeNode2, "/");
        adminTree.add (treeNode3, treeNode1);
        adminTree.add (treeNode4, treeNode2);

        adminTreeGrid.draw ();       
    }

"Node 1" and "Node 2" a folder with a "+" sign is displayed, but "Node 3" and "Node 4" are not displayed, make it possible to expand them.

Please help if I missed something.

Thanks Vamsi

+5
source share
2

setIsFolder (true) node . , - .

+5

, "getCanDropOnLeaves (true)"

API TreeGrid

+1

All Articles