Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update data with TreeStore or TreeEditor component?

Tags:

extjs

extjs4

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 : I have 2 components on my page :

Tree.Panel who display data with TreeStore and Panel to editing data, because i don't find how to editing tree directly ?!

I want to use a Submit button to update data on my tree but i don't understand how to do this?!

If its possible ?!

I don't understand how i can add new node , upgrade node and delete node ?!

Or there exist maybe TreeEditor component ?!

Thanks a lot to helps :)

like image 983
Vincent Guesné Avatar asked May 02 '11 19:05

Vincent Guesné


1 Answers

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.

like image 123
Abdel Raoof Olakara Avatar answered Sep 29 '22 08:09

Abdel Raoof Olakara