Noggy
16 Jan 2009, 9:55 AM
Hi all !
I wrote the following piece of code to catch events from selected datalistitems
DataList list = new DataList();
list.setBorders(false);
DataListSelectionModel sm = new DataListSelectionModel(SelectionMode.SINGLE);
list.setSelectionModel(sm);
Listener<ComponentEvent> listener = new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
DataList l = (DataList) ce.component;
EntitiesModel model = store.findModel("entityStep", l.getSelectedItem().getText());
(l.getSelectionModel()).deselect(l.getSelectedItem());
}
};
list.addListener(Events.SelectionChange, listener);
but unfortunatly deselecting the selected DataListItem throws a NullPointerException. The behaviour actually works and the item is deselected , but still this exception is throw.
Any ideas why ?
TIA,
Noggy
I wrote the following piece of code to catch events from selected datalistitems
DataList list = new DataList();
list.setBorders(false);
DataListSelectionModel sm = new DataListSelectionModel(SelectionMode.SINGLE);
list.setSelectionModel(sm);
Listener<ComponentEvent> listener = new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
DataList l = (DataList) ce.component;
EntitiesModel model = store.findModel("entityStep", l.getSelectedItem().getText());
(l.getSelectionModel()).deselect(l.getSelectedItem());
}
};
list.addListener(Events.SelectionChange, listener);
but unfortunatly deselecting the selected DataListItem throws a NullPointerException. The behaviour actually works and the item is deselected , but still this exception is throw.
Any ideas why ?
TIA,
Noggy