简体   繁体   中英

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:

  • 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.
You have to override this method to make it "smarter"... See : 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)

You can refer to this for an example:
Dijit Tree filtering and search not working on ObjectStoreModel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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