简体   繁体   English

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

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

I am using the following code to render a dijit.Tree, as you can see from the picture I have these issues: 我正在使用以下代码来渲染dijit.Tree,如您从图片中看到的那样,我遇到了这些问题:

  • The folder are marked with the "plus icon", but not children are present for any node. 该文件夹带有“加号图标”标记,但是任何节点都没有子代。
  • If I click on a folder the "plus icon" disappear (should never be there in first place). 如果我单击一个文件夹,“加号”图标就会消失(不应放在首位)。

Could you please tell me what am I doing wrong here? 您能告诉我我在做什么错吗?

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

在此处输入图片说明

This is due to the method mayHaveChildren of the model. 这是由于模型的mayHaveChildren方法mayHaveChildren
You have to override this method to make it "smarter"... See : https://dojotoolkit.org/documentation/tutorials/1.6/store_driven_tree/ 您必须重写此方法才能使其“更智能” ...请参阅: https : //dojotoolkit.org/documentation/tutorials/1.6/store_driven_tree/

mayHaveChildren(object) - Indicates whether or not an object may have children (prior to actually loading the children) mayHaveChildren(object)-指示对象是否有子对象(在实际加载子对象之前)

You can refer to this for an example: 您可以参考以下示例:
Dijit Tree filtering and search not working on ObjectStoreModel Dijit树过滤和搜索不适用于ObjectStoreModel

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

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