How to update data with TreeStore or TreeEditor component?

前端 未结 1 553
后悔当初
后悔当初 2021-01-12 02:49

I use tree.Panel and TreeStore component. I use JSON file to store my datas but i would like know, how to upgrade my data with a TreeStore ?!

I explain my problem :

相关标签:
1条回答
  • 2021-01-12 03:44

    I think we are yet to see a TreeEditor component. But there are ways to manipulate your existing tree. You should be able to add, update, remove tree nodes using the methods of NodeInterface.

    You have methods like:

    • appendChild
    • insertChild
    • insertBefore
    • removeChild
    • replaceChild

    etc...

    Here is a sample code how you can append a new node to your tree:

    var node = myTreeStore.getRootNode();
    
    node.appendChild({
        text: 'A New node'
    });
    

    Similarly you can make use of other methods to manipulate the tree. To insert node into specific location, you will have to use the insertChild. For this method, you will have to specify the location as well.

    In short, the access point of editing your tree is your TreeStore's getRootNode() method.

    0 讨论(0)
提交回复
热议问题