A.Rothe
17 Nov 2011, 4:58 AM
Hi,
I have a TreeGrid and a TreeStore. If I add a new record to the store manually, I try to expand the parent node of the new record:
Parent parent = new Parent("parent");
Record record = new Record("record");
store.add(parent, record, false);
Version version = new Version("a version");
store.add(record, version, false);
I have added a StoreListener to the store:
store = new TreeStore<ModelData>();
store.addStoreListener(new RecordStoreListener());
The listener is implemented as:
private class RecordStoreListener extends StoreListener<ModelData> {
public void storeAdd(StoreEvent<ModelData> se) {
TreeStoreEvent<ModelData> tse = (TreeStoreEvent<ModelData>) se;
tree.setExpanded(tse.getParent(), true);
Info.display("haha", (String) tse.getParent().get("name"));
}
}
Parent, Record and Version store the given String as property "name". The Info is displayed twice, one for the first add() and one for the second add(). The store seems to be okay.
But the TreeGrid displays the newly added records twice! If I remove the listener, all is fine, but with the listener, the nodes are duplicated within the tree.
Any ideas?
Thanks
Andre :((
I have a TreeGrid and a TreeStore. If I add a new record to the store manually, I try to expand the parent node of the new record:
Parent parent = new Parent("parent");
Record record = new Record("record");
store.add(parent, record, false);
Version version = new Version("a version");
store.add(record, version, false);
I have added a StoreListener to the store:
store = new TreeStore<ModelData>();
store.addStoreListener(new RecordStoreListener());
The listener is implemented as:
private class RecordStoreListener extends StoreListener<ModelData> {
public void storeAdd(StoreEvent<ModelData> se) {
TreeStoreEvent<ModelData> tse = (TreeStoreEvent<ModelData>) se;
tree.setExpanded(tse.getParent(), true);
Info.display("haha", (String) tse.getParent().get("name"));
}
}
Parent, Record and Version store the given String as property "name". The Info is displayed twice, one for the first add() and one for the second add(). The store seems to be okay.
But the TreeGrid displays the newly added records twice! If I remove the listener, all is fine, but with the listener, the nodes are duplicated within the tree.
Any ideas?
Thanks
Andre :((