1. #1
    Ext JS Premium Member
    Join Date
    Oct 2009
    Posts
    4
    Vote Rating
    0
    colin.doig.wialus is on a distinguished road

      0  

    Default Refresh node in tree panel

    Refresh node in tree panel


    Hi, in version 3 I used this to reload (from the server) a single node in a TreePanel:

    treePanel.on('click', function(node, event) {

    // some code to send update message to the server, causing the children to change

    node.reload();
    });

    But I can't figure out how to do the same thing in extjs 4.

    treePanel.on('itemclick', function(view, record){

    // some code to send update message to the server, causing the children to change

    // what goes here???
    });


    Thanks for your help

  2. #2
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    894
    Vote Rating
    39
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      1  

    Default


    Heh, yeah, it's a bit of a faff now... NodeInterface is not very good IMHO.

    Anyway, I do the following:
    PHP Code:
    // Remove all current children if clear on load not set
    if (!treeStore.clearOnLoad) {
        
    record.removeAll();
    }

    // Call load, refreshing our view when done...
    var viewRefresher = function() {
        
    view.refresh();
    };

    treeStore.load({
        
    noderecord,
        
    callbackviewRefresher
    }); 
    Obviously you need your tree store, and the view refreshing bit is needed for me since I change the icons during fillNode, and it doesn't seem to stick unless you kick it

    Not quite as simple as pre-Ext 4....

    Hope that helps,
    Westy

  3. #3
    Ext JS Premium Member
    Join Date
    Oct 2009
    Posts
    4
    Vote Rating
    0
    colin.doig.wialus is on a distinguished road

      0  

    Default


    Thanks Westy, it works

  4. #4
    Sencha User Priet's Avatar
    Join Date
    Jun 2007
    Posts
    22
    Vote Rating
    0
    Priet is on a distinguished road

      0  

    Default


    The above workaround does the job, however it is not very efficient.

    Does anyone know how to reload a single node in a tree?

    The 3.x way was by far less complex

  5. #5
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    894
    Vote Rating
    39
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Agreed, and it only reloads children, not that nodes data itself.

    It's on my list to sort out properly, but no time at the moment.
    Of course, if someone gets there first I'd be happy to re-use


    Really do not like the new tree, it's painful, buggy and slow...

  6. #6
    Sencha User Priet's Avatar
    Join Date
    Jun 2007
    Posts
    22
    Vote Rating
    0
    Priet is on a distinguished road

      0  

    Default


    Quote Originally Posted by westy View Post
    Really do not like the new tree, it's painful, buggy and slow...
    Amen to that! The new tree is definitely a huge step back I don't care about models, columns etc, I just want to add nodes and reload them!

  7. #7
    Ext JS Premium Member
    Join Date
    Mar 2011
    Posts
    178
    Vote Rating
    0
    astrocybernaute is on a distinguished road

      0  

    Default


    i join my voice to yours..
    i still cant make a treepanel work not even the example!

  8. #8
    Sencha User
    Join Date
    Oct 2010
    Location
    Knoxville, TN
    Posts
    133
    Vote Rating
    1
    Kcarpenter is on a distinguished road

      0  

    Default


    I have to say I fought with it for a week as well just to get ours ported from 3.x to 4.
    Finally I figured out you could pass a Node to the load method to get nodes loaded.
    Some how I managed to miss that in documentation and all searching on line.

    Now what I wish I could figure out quickly is how to on ItemClick, to not only load the nodes, but also expand it after the load happens. Anyone got that down?

  9. #9
    Sencha User
    Join Date
    Jul 2007
    Posts
    9
    Vote Rating
    0
    paulocordeiro is on a distinguished road

      0  

    Default


    I have same problem.

    Code:
    var node = myTree.getStore().getNodeById('myId');  // OK !!
    if i try update the TreeStore

    Code:
    myTree.getStore().load();
    and recover then node again,


    Code:
    var node = myTree.getStore().getNodeById('myId');  // UNDEFINED

  10. #10
    Sencha User
    Join Date
    Jun 2011
    Posts
    5
    Vote Rating
    0
    zhangming_3113 is on a distinguished road

      0  

    Default


    I have tried you method to refresh my tree,but error occurred:"the mothod is not supported"

Similar Threads

  1. Select the specific node, when refresh the tree
    By cramade in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 5 Jan 2011, 1:51 PM
  2. Focus on the specific node, when refresh the tree.
    By cramade in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Jan 2010, 4:21 PM
  3. Tree Node Refresh 2.2
    By millenovecento in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 28 Jan 2009, 8:44 AM
  4. Refresh Grid content on click event of tree node
    By AmitOlsys in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 30 Jul 2008, 11:01 PM

Thread Participants: 12

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."