Question

I am working with ExtJS 4.2 and have two tree panels. I am also using treeviewdragdrop to be able to drag some nodes from left tree to right.

enter image description here

Now let me explain the problem I am having.

You can see that AMAZONE is the Service Alias and as soon you change something in that textfield, there is a listener on blur to update right tree's root text. Since its AMAZON now, the root is also AMAZON. Then you can drag items from left to right like i have in the picture (Yhoo, dbTask).

This is when I get into trouble. When I go back and change the SERVICE ALIAS, it changes the name but nodes disappear since I have to reload the root node again in order to see the updated root text. Is there a way to maybe update the view, that actually updates whatever changed were made. This what I have now.

This is the code

listners:
{
    blur: function()
    {
        var root_node = right_tree.getRootNode();
        root_node.data.text = new_alias_name;
        right_tree.store.load(); // or reload()
    }
}

I know I can save dropped node into a variable and as soon as I reload the tree, I can assign those as children. But something tells me there should be simpler way. Thnaks ;)

Was it helpful?

Solution

Use:

root_node.set('text', new_alias_name');

And remove the call to load.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top