Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2008
    Posts
    79
    Vote Rating
    0
    Cputerace is on a distinguished road

      0  

    Default [CLOSED]TreeStore.add(parent, child, true) not adding child to parent.getChildren()

    [CLOSED]TreeStore.add(parent, child, true) not adding child to parent.getChildren()


    Code:
    package com.mycompany.gwtprototype.client;
    
    import com.extjs.gxt.ui.client.data.BaseModelData;
    import com.extjs.gxt.ui.client.data.BaseTreeModel;
    import com.extjs.gxt.ui.client.event.ButtonEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.store.TreeStore;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
    import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.Window;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class GwtPrototype implements EntryPoint {
    
        private Viewport v = new Viewport();
    	private TreeStore<BaseModelData> ts;
    	private TreePanel<BaseModelData> tp;
        
        public void onModuleLoad() {
            RootPanel.get().add(v);
            v.setHeight("100%");
            v.setLayout(new FlowLayout());
            ts = new TreeStore<BaseModelData>();
    		tp = new TreePanel<BaseModelData>(ts);
    		tp.setDisplayProperty("name");
    		final BaseTreeModel root = new BaseTreeModel();
    		root.set("name", "root");
    		ts.add(root, true);
    		BaseTreeModel child = new BaseTreeModel();
    		child.set("name", "child");
    		ts.add(root, child, true);
    		Button b = new Button(){};
    		b.addSelectionListener(new SelectionListener<ButtonEvent>(){
    
    			@Override
    			public void componentSelected(ButtonEvent ce)
    			{
    				Window.alert(root.getChildCount() + "");
    			}});
    		v.add(tp);
    		v.add(b);
    		v.layout();
        }
    }
    Clicking the button results in 0, when I believe it should be 1. ts.add(root, child, true) does not seem to be updating the root model's children.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You have to get the childcount from the store and not the model.

    The relationships between parent and child are maintained internally by the store, therefore, the children of root is never added directly to the root model.

    If you change your code to be the following it works:

    Code:
      System.out.println(ts.getChildCount(root));
    I am closing the issue.

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