PDA

View Full Version : [CLOSED] On "Events.Select" of ListVew: Selection Count is wrong...



Yan26
22 Jul 2009, 6:48 PM
Hi!

I'm using:

GWT 1.7
GXT 2.0.1
Hosted Mode


The following code should simply give you the number of selected item in the ListView after you select or unselect the only item available. It seams that the selection count occurs after the event. See for yourself, each time you select or unselect the only item in the list, you are getting the count for the previous action...



public class Test implements EntryPoint {
public void onModuleLoad() {
ContentPanel panel = new ContentPanel();

BaseModelData data = new BaseModelData();
data.set("value", "Click me!");

ListStore<ModelData> store = new ListStore<ModelData>();
store.add(data);

ListView<ModelData> listView = new ListView<ModelData>();
listView.addListener(Events.Select, new Listener<ListViewEvent<ModelData>>() {
public void handleEvent(ListViewEvent<ModelData> be) {
MessageBox.alert(null, String.valueOf(be.getListView().getSelectionModel().getSelectedItems().size()), null);
}
});
listView.setDisplayProperty("value");
listView.setStore(store);

RootPanel.get().add(listView);
}
}


Thank you!

sven
22 Jul 2009, 10:39 PM
You need to listen to the selectionchange event of the selectionmodel. I am closing this issue.

Yan26
26 Jul 2009, 7:12 PM
Thank you for your time.

Sorry that I didn't see that myself...