1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default How to refresh a part of an async tree

    How to refresh a part of an async tree


    Hi,

    Is it possible to refresh the part of an async tree, I mean refresh a given node (the display test could have been changed) and its children.
    I've already tried
    Code:
    treeStore.fireEvent(Store.DataChanged,new TreeStoreEvent(treeStore)); //seems to reload the whole tree and doesn't look nice
    loader.loadChildren(myNode); //add the children to the root node instead of myNode
    loader.load(myNode); //remove all tree nodes and add the children to the root node instead of myNode

  2. #2
    Ext User
    Join Date
    Jun 2008
    Location
    Utrecht, Netherlands
    Posts
    24
    Vote Rating
    0
    assassin is on a distinguished road

      0  

    Default


    I didn't find a nice solution to but maybe you can use:

    Code:
    store.commitChanges();
    myNode.setExpand(true);
    Regards,
    Rick

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default


    Thanks for the help. But actually, it doesn't do what I expect. Let's explain what I am doing :
    - I show an async tree in the west region.
    - when I select an item, it opens a form (in center region) to edit the model bound to this tree item.
    - I change the name of the item in the form.
    - when I click on a "Ok" button, I want to refresh only the tree item that was edit.

    Unfortunately, the 2 lines you propose can't do that. For now, the only way I found to do that is
    Code:
    treeStore.fireEvent(Store.DataChanged,new TreeStoreEvent(treeStore));
    but it refreshes the whole tree

  4. #4
    Ext User
    Join Date
    May 2008
    Posts
    97
    Vote Rating
    0
    jraue is on a distinguished road

      0  

    Default


    zaccret,

    I have the very same situation as you. For me, store.update(myModel) updates the name nicely, but not the children. To reload the names of the children as well, you might try somthing along:

    Code:
         private void relabelTree() {
         for (final TreeItem child : tree.getRootItem().getItems()) {
         relabelTree(child);
         }
         }
        
         private void relabelTree(final TreeItem ti) {
         store.update((MediaObject) ti.getData());
         for (final TreeItem child : ti.getItems()) {
         relabelTree(child);
         }
    HTH,
    Joachim

  5. #5
    Ext User
    Join Date
    May 2008
    Posts
    97
    Vote Rating
    0
    jraue is on a distinguished road

      0  

    Default


    By the way, generally, I agree, it would be VERY nice to have a way to have an item and all its children reloaded.

  6. #6
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default


    Thanks, jraue, I found this method a few minutes ago. It is nice.
    Thanks also for the children reload solution. However, you're right, it would be nice to have a convenience method to update a node AND its children.

  7. #7
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default


    Now I would like to add children (one by one) to a given node. It isn't possible with the update method.
    I guess I have to use the TreeStore.add(M parent, M item, boolean addChildren) method for each add child. I wonder what will happen if I do that on a node which has not yet been expanded.

  8. #8
    Ext User
    Join Date
    May 2008
    Posts
    97
    Vote Rating
    0
    jraue is on a distinguished road

      0  

    Default


    Try it. My problem so far was that you will get 2+ new TreeItems all pointing to the same Model. I haven't found out how to avoid this either...

  9. #9
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Default


    It works well in both cases (parent already expanded or not).

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar