Christian Hemker
10 Jul 2008, 11:46 AM
Hello,
This is a second Post of the same Problem,
but now in the GXT Bugs Forum. http://extjs.com/forum/showthread.php?t=39967
I used the sample Async Tree from the Ext GWT explorer demo you provide with the Release Version gxt-1.0.
I want to expand the first level of all rootItems.
From the Thread http://extjs.com/forum/showthread.php?t=39967 I got the idea how to do that.
I use a Listener for the load Event with loader.addLoadListener( new Listener())
and then I get the rootItems from the binder.findItem() to call the
treeItem.setExpanded(true) on all of them:
loader.load(null);
loader.addLoadListener( new LoadListener(){
@Override
public void loaderLoad(LoadEvent le) {
if( isRootInited == false){
isRootInited = true;
List<FileModel> rootItems = store.getRootItems();
for (final FileModel model : rootItems) {
if( model != null ) {
TreeItem item = (TreeItem) binder.findItem( model);
// can not proove if item.isLeaf() because the children are not added at the moment
if( item != null ) {
item.setExpanded(true);
}
}
}
}
super.loaderLoad(le);
}
});
This works if I call setExpanded(true) on only one TreeItem.
If I call it on more than one TreeItem in the same level I get
the following NullPointerException in Host mode.
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI.aft erExpand(TreeItemUI.java:74)
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI$2.h andleEvent(TreeItemUI.java:91)
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI$2.h andleEvent(TreeItemUI.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.fireE vent(BaseObservable.java:74)
at com.extjs.gxt.ui.client.fx.Fx.onComplete(Fx.java:1 65)
at com.extjs.gxt.ui.client.fx.Fx$1.onComplete(Fx.java :67)
at com.google.gwt.animation.client.Animation.update(A nimation.java:217)
at com.google.gwt.animation.client.Animation.updateAn imations(Animation.java:52)
at com.google.gwt.animation.client.Animation.access$0 (Animation.java:47)
at com.google.gwt.animation.client.Animation$1.run(An imation.java:133)It is possible to avoid the exception if I call tree.setAnimate(false)
before the tree is given to the binder.
But the result is, that the tree only opens and shows the children of one parent,
and not the whole tree. The parents are gone and the second children are also not available.
OS: Windows XP
GXT Version: gxt-1.0
Effect occours in hosted and web mode
Browser: IE 7.0
To reproduce this you can change the newest Download of the explorer Sample from gxt-1.0.
I have only changed the Files in my attachment.
com.extjs.gxt.samples.explorer.client.pages.AsyncTreePage
com.extjs.gxt.samples.explorer.server.FileServiceImpl
When you call the Async Tree you see the problem.
How can I expand more than one TreeItem directly in Java?
Thanks,
Christian
This is a second Post of the same Problem,
but now in the GXT Bugs Forum. http://extjs.com/forum/showthread.php?t=39967
I used the sample Async Tree from the Ext GWT explorer demo you provide with the Release Version gxt-1.0.
I want to expand the first level of all rootItems.
From the Thread http://extjs.com/forum/showthread.php?t=39967 I got the idea how to do that.
I use a Listener for the load Event with loader.addLoadListener( new Listener())
and then I get the rootItems from the binder.findItem() to call the
treeItem.setExpanded(true) on all of them:
loader.load(null);
loader.addLoadListener( new LoadListener(){
@Override
public void loaderLoad(LoadEvent le) {
if( isRootInited == false){
isRootInited = true;
List<FileModel> rootItems = store.getRootItems();
for (final FileModel model : rootItems) {
if( model != null ) {
TreeItem item = (TreeItem) binder.findItem( model);
// can not proove if item.isLeaf() because the children are not added at the moment
if( item != null ) {
item.setExpanded(true);
}
}
}
}
super.loaderLoad(le);
}
});
This works if I call setExpanded(true) on only one TreeItem.
If I call it on more than one TreeItem in the same level I get
the following NullPointerException in Host mode.
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI.aft erExpand(TreeItemUI.java:74)
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI$2.h andleEvent(TreeItemUI.java:91)
at com.extjs.gxt.ui.client.widget.tree.TreeItemUI$2.h andleEvent(TreeItemUI.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.fireE vent(BaseObservable.java:74)
at com.extjs.gxt.ui.client.fx.Fx.onComplete(Fx.java:1 65)
at com.extjs.gxt.ui.client.fx.Fx$1.onComplete(Fx.java :67)
at com.google.gwt.animation.client.Animation.update(A nimation.java:217)
at com.google.gwt.animation.client.Animation.updateAn imations(Animation.java:52)
at com.google.gwt.animation.client.Animation.access$0 (Animation.java:47)
at com.google.gwt.animation.client.Animation$1.run(An imation.java:133)It is possible to avoid the exception if I call tree.setAnimate(false)
before the tree is given to the binder.
But the result is, that the tree only opens and shows the children of one parent,
and not the whole tree. The parents are gone and the second children are also not available.
OS: Windows XP
GXT Version: gxt-1.0
Effect occours in hosted and web mode
Browser: IE 7.0
To reproduce this you can change the newest Download of the explorer Sample from gxt-1.0.
I have only changed the Files in my attachment.
com.extjs.gxt.samples.explorer.client.pages.AsyncTreePage
com.extjs.gxt.samples.explorer.server.FileServiceImpl
When you call the Async Tree you see the problem.
How can I expand more than one TreeItem directly in Java?
Thanks,
Christian