PDA

View Full Version : Treetable - removeAll



skhan
29 May 2008, 3:13 PM
I'm a little confused...

I modified your TreeTablePage slightly by adding this:



ButtonBar buttonBar = new ButtonBar();
buttonBar.add(new Button("Binder Remove all", new SelectionListener() {

public void componentSelected(ComponentEvent ce) {
binder.removeAll();
}

}));


buttonBar.add(new Button("Store Remove all", new SelectionListener() {

public void componentSelected(ComponentEvent ce) {
store.removeAll();
}

}));


buttonBar.add(new Button("reload", new SelectionListener() {

public void componentSelected(ComponentEvent ce) {
loader.load(null);
}

}));


add(buttonBar);

I declared all the relevant references as final so I can access them in the anonymous methods, so everything compiles fine.

I added three buttons:

Binder Remove all
Store Remove All
Reload


My question is this, how am I supposed to remove all the items from the treetable to be able to reload it with fresh data?

The reload method seems to work except it adds the elements to the current store, so I'm left with two gxt TreeTableItems at the root level say.

Neither the TreeTableBinder's nor the TreeStore's removeAll seems to work.
In fact, they both throw Javascript errors.
I haven't tested this in hosted mode to see the more meaningful messages.

Am I doing something wrong here? Is there another way for me to reload a new set of TreeTableItems?

Thanks

darrellmeyer
2 Jun 2008, 4:02 PM
There was a null pointer being thrown with Tree.removeAll. This has been fixed. You do not have to call removeAll when reloading via the loader as it is done automatically. I tested your code and everything works. The removeAll from the binder has been removed as you should call removeAll on the store. Fix is in SVN.