PDA

View Full Version : [FIXED] Exception on treepanel item collapse



Cputerace
24 Jun 2009, 6:36 AM
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.store.TreeStore;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.google.gwt.core.client.EntryPoint;
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 FitLayout());
ts = new TreeStore<BaseModelData>();
tp = new TreePanel<BaseModelData>(ts);
tp.setDisplayProperty("name");
ts.add(getBaseTreeModelWithChild(), true);
ts.add(getBaseTreeModelWithChild(), true);
v.add(tp);
v.layout();
}

protected BaseTreeModel getBaseTreeModelWithChild()
{
BaseTreeModel baseTreeModel = new BaseTreeModel();
BaseTreeModel baseTreeModel2 = new BaseTreeModel();
baseTreeModel.set("name", "my name");
baseTreeModel2.set("name", "my name2");
baseTreeModel.add(baseTreeModel2);
return baseTreeModel;
}


}expand then collapse one of the nodes, you get:


[ERROR] Uncaught Exception Occured: (TypeError): 'firstChild' is null or not an object
number: -2146823281
description: 'firstChild' is null or not an object
com.google.gwt.core.client.JavaScriptException: (TypeError): 'firstChild' is null or not an object
number: -2146823281
description: 'firstChild' is null or not an object
at com.google.gwt.dom.client.DOMImpl.getFirstChildElement(Native Method)
at com.google.gwt.dom.client.Element$.getFirstChildElement$(Element.java:169)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.cleanNode(TreePanel.java:1318)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.cleanCollapsed(TreePanel.java:1309)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.setExpanded(TreePanel.java:782)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.setExpanded(TreePanel.java:718)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.toggle(TreePanel.java:891)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.onClick(TreePanel.java:1100)
at com.extjs.gxt.ui.client.widget.treepanel.TreePanel.onComponentEvent(TreePanel.java:539)
at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:756)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)

Cputerace
24 Jun 2009, 7:09 AM
Added example code.

darrellmeyer
24 Jun 2009, 12:36 PM
Thanks for the code. Fixed in SVN.

crazycatlady
29 Jun 2009, 9:57 AM
There isn't a version number on this thread, is this fixed in RC1?

sven
29 Jun 2009, 9:58 AM
Yes.