PDA

View Full Version : need help on selectchange event on ListView



avilanchee
17 Nov 2009, 11:36 PM
Hey guys,

I get a com.extjs.gxt.ui.client.event.SelectionEvent cannot be cast to com.extjs.gxt.ui.client.event.SelectionChangedEvent exception wen i add a selectionchange event on the list view. The code worked fine for sometime. But for some unknown reason the code throws the above exception. Help would be greatly appriciated

imagesListView.getSelectionModel().addListener(Events.SelectionChange,
new Listener<SelectionChangedEvent<SlideShowImageModel>>() {
public void handleEvent(
SelectionChangedEvent<SlideShowImageModel> be) {

SlideShowImageModel model = (SlideShowImageModel) imagesListView
.getSelectionModel().getSelectedItem();
SlideShowImages image = model.getSlideShowImageModel();
}
});

Model

private static final long serialVersionUID = 1L;
private SlideShowImages image;

public SlideShowImageModel(SlideShowImages image){
this.image = image;
set("url", image.getName()+ApplicationConstants.SLIDESHOW_THUMB_PREFIX+image.getImage_name());
set("name",image.getName()+ApplicationConstants.SLIDESHOW_THUMB_PREFIX+image.getImage_name());
set("comments",image.getComments());
}

public SlideShowImages getSlideShowImageModel(){
return image;
}

thanks
Avinash

sven
18 Nov 2009, 4:13 AM
Should be quite clear what is wrong.THe exception tells you exactly what you need to do.

Change SelectionChangedEvent to SelectionEvent.