Run a function after adding item to store from a Tree

Asked

Viewed 56 times

0

I have 2 Trees in my project made with Extjs4, and one of the Trees is added value in store after an event. I would like as soon as the value is added in store of the first tree, the second to re-update with the new values of the first. As if it were a callBack after I use the function appendChild.

Code when I add value in the first Tree:

...
handler: function(){
            var treeProc = Ext.getCmp('int-proc').store;
            var ttP = treeProc.getRootNode();

            var treeInt = Ext.getCmp('int-int').store;
            var ttI = treeInt.getRootNode();

        Ext.each(ttI.childNodes, function(node){
            var plop = node.data['text'].substr(-3);
            var change = node.data['text'].replace(plop, 'doc');

            ttP.getChildAt(0).appendChild({
                txt: change,
                tipo: 'intimacao',
                id: "9898",
                data: '10/06/2014',
                leaf: true
            });
        });
        ttI.removeAll(true);
    }
   ...

The second tree has nothing, only is loaded with new values added in the first tree.

  • updated my post with code

  • Did you find a solution? Poste as an answer to help other people.

  • Put the first store code and the name of the second store. Look at this code you posted I can’t even begin to help you unless I tell you to use the Istener add from his first store.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.