1. #1
    Ext User
    Join Date
    Jul 2008
    Location
    France - Lille
    Posts
    6
    Vote Rating
    0
    Zorn is on a distinguished road

      0  

    Default How add child model to a tree ?

    How add child model to a tree ?


    With MyGWT, to add a child to a tree, i had only to do model.add(child).
    But with GXT, it seems that's don't work.
    The "child" TreeItem is never showed.
    What's wrong with my code ?


    Code:
    public class Test implements EntryPoint {
    
      /**
       * This is the entry point method.
       */
      public void onModuleLoad() {
    
        Tree tree = new Tree();
        BaseTreeLoader loader = new BaseTreeLoader(new TreeModelReader());
        TreeStore<Model> store = new TreeStore<Model>(loader);
        TreeBinder<Model> binder = new TreeBinder<Model>(tree, store);
        store.setModelComparer(new DefaultModelComparer<Model>());
        store.setMonitorChanges(true);
        binder.setDisplayProperty("name");
        Window window = new Window();
        window.setLayout(new FitLayout());
        window.add(tree);
        BaseTreeModel root = new BaseTreeModel();
        root.set("name", "ROOT");
        // add the root
        store.add(root, true);
        BaseTreeModel child = new BaseTreeModel();
        // add one child
        child.set("name", "CHILD");
        store.add(root, child, true);
        window.show();
        // only one node is show
        // "child" is not added to the Tree
      }
    }

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    There was a bug in TreeBinder when adding children after the parent was renderered but before the parent had been expanded. This is fixed in SVN. As a workaround, you use this code:

    Code:
    public void onModuleLoad() {
        Tree tree = new Tree();
    
        TreeStore<Model> store = new TreeStore<Model>();
        store.setModelComparer(new DefaultModelComparer<Model>());
        store.setMonitorChanges(true);
    
        BaseTreeModel root = new BaseTreeModel();
        root.set("name", "ROOT");
        // add the root
        store.add(root, false);
        BaseTreeModel child = new BaseTreeModel();
        // add one child
        child.set("name", "CHILD");
        store.add(root, child, false);
    
        TreeBinder<Model> binder = new TreeBinder<Model>(tree, store);
        binder.setDisplayProperty("name");
        binder.init();
    
        Window window = new Window();
        window.setLayout(new FitLayout());
        window.add(tree);
    
        window.show();
      }

Thread Participants: 1

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..." hd porno faketaxi