SmartGWT TreeGrid 的叶/子节点不显示用于展开它们的文件夹图标

发布于 2024-11-08 01:51:53 字数 1675 浏览 0 评论 0原文

我需要在使用文件夹的“+”号扩展树节点时获取树节点的子记录。如果任何特定节点没有子节点,“+”号应该消失。此要求与链接中的要求类似,

但有些情况下这不起作用我。仅父节点显示文件夹,子节点不默认为文件夹。下面是我正在使用的代码。我已经从上面的链接复制了代码。唯一的变化是用树节点替换数据源。

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();       
    }

“节点 1”和“节点 2”显示带有“+”号的文件夹,但“节点 3”和“节点 4”不显示提供展开它们的选项。

如果我遗漏了什么,请帮忙。

谢谢, 瓦姆西

I have a requirement to fetch the child records of a tree node on expanding it using the "+" sign of the folder. If any particular node doesnt have children the "+" sign should vanish. This requirement is similar to the one in link

But some how this doesn't work for me. Only parent node shows a folder and the child nodes do not default to a Folder. Below is the code I am using. I have copied the code from the above link. The only change being 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" are showing a folder with a "+" sign but "Node 3" and "Node 4" do not show give an option to expand them.

Please help out if I am missing something.

Thanks,
Vamsi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

总攻大人 2024-11-15 01:51:53

默认情况下为每个节点使用 setIsFolder(true) 并为叶节点设置为 false 来解决此问题。如果有人需要示例代码,请告诉我。

Solved this using setIsFolder(true) by default for each node and making it false for leaf nodes. Let me know if anyone needs sample code.

初相遇 2024-11-15 01:51:53

认为您可能需要使用“getCanDropOnLeaves(true)”

TreeGrid 的 API 链接

think you may need to use "getCanDropOnLeaves(true)"

API Link for TreeGrid

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文