繁体   English   中英

dijit.Tree文件夹即使没有子项也带有图标加号出现

[英]dijit.Tree Folders appear with a icon PLUS even if no children are present

我正在使用以下代码来渲染dijit.Tree,如您从图片中看到的那样,我遇到了这些问题:

  • 该文件夹带有“加号图标”标记,但是任何节点都没有子代。
  • 如果我单击一个文件夹,“加号”图标就会消失(不应放在首位)。

您能告诉我我在做什么错吗?

   this._tree = new Tree({
        model: this._model,
        showRoot: false,
        autoExpand: false,
        persist: false,
        getLabel: function (item) {
            return item.name;
        }
    });
    this._tree.placeAt(this.node);
    this._tree.startup();

在此处输入图片说明

这是由于模型的mayHaveChildren方法mayHaveChildren
您必须重写此方法才能使其“更智能” ...请参阅: https : //dojotoolkit.org/documentation/tutorials/1.6/store_driven_tree/

mayHaveChildren(object)-指示对象是否有子对象(在实际加载子对象之前)

您可以参考以下示例:
Dijit树过滤和搜索不适用于ObjectStoreModel

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM