How to update dojo tree data dynamically

后端 未结 7 915
隐瞒了意图╮
隐瞒了意图╮ 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:13

    While going through these answers I've built my own method to update specific nodes once at a time and NOT need the refresh.

    _refreshNodeMapping: function (newNodeData) {
    
        if(!this._itemNodesMap[newNodeData.identity]) return;
    
        var nodeMapToRefresh = this._itemNodesMap[newNodeData.identity][0].item;
        var domNode = this._itemNodesMap[newNodeData.identity][0].domNode;
    
        //For every updated value, reset the old ones
        for(var val in newNodeData)
        {
            nodeMapToRefresh[val] = newNodeData[val];
    
            if(val == 'label')
            {
                domNode.innerHTML = newNodeData[val];
            }
        }  
    }
    

提交回复
热议问题