How to update dojo tree data dynamically

后端 未结 7 886
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 14:39

I would like to know how ot update the data of the dojo.dijit.tree component dynamically. At the moment I\'m creating the tree using dojo.data.ItemFileReadStore and dijit.tree.F

相关标签:
7条回答
  • 2021-02-04 15:23

    Layke's solution did not work for me. I am using dojo 1.9.1. My store is of type "ItemFileWriteStore" and the model of type "TreeStoreModel".

    myStore = new ItemFileWriteStore({
        url : "../jaxrs/group/tree"
    });
    
    itemModel = new TreeStoreModel({
        store : myStore,
        query : {
            id : "0"
        }
    });
    parser.parse();
    

    This works for me:

    var tree = dijit.byId('myTree');
    tree.dndController.selectNone(); 
    tree._itemNodesMap = {};
    tree.model.root = null;
    tree.model.store.clearOnClose = true;
    tree.model.store.urlPreventCache = true;
    tree.model.store.revert(); 
    tree.model.store.close();
    tree.rootNode.state = "UNCHECKED";
    if (tree.rootNode) {
        tree.rootNode.destroyRecursive();
    }
    tree.postMixInProperties();
    tree._load();
    
    0 讨论(0)
提交回复
热议问题