View Full Version : [FIXED] BeforeAdd and Add events of DataView aren't DataViewEvents

13 Jun 2008, 7:46 PM
Hi. The problem is that when I add a Listener<DataViewEvent> to a DataView for the BeforeAdd and Add event, and when the event occurs, the program throws an exception saying that the ContainerEvent can't be cast to a DataViewEvent, so it seems these events are ContainerEvents. Aren't they supposed to be DataViewEvents?


P.S. The SelectionChange DataViewEvent works well, I don't know how it works with BeforeRemove, Remove and ContextMenu events.

16 Jun 2008, 3:47 PM
Fix is in SVN.

30 Jun 2008, 9:20 AM
Hi. Sorry to bother again but it seems the problem still occurs. My program throws:

[ERROR] Uncaught exception escaped
java.lang.ClassCastException: com.extjs.gxt.ui.client.event.ContainerEvent cannot be cast to com.extjs.gxt.ui.client.event.DataViewEvent
at com.drl.rts.management.client.pages.NetworkPage$NetworkDiagramBeforeAddListener.handleEvent(NetworkPage.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.fireEvent(BaseObservable.java:74)
at com.extjs.gxt.ui.client.widget.Component.fireEvent(Component.java:398)
at com.extjs.gxt.ui.client.widget.Container.insert(Container.java:294)
at com.extjs.gxt.ui.client.widget.DataView.insert(DataView.java:242)
at com.extjs.gxt.ui.client.widget.DataView.insert(DataView.java:1)
at com.extjs.gxt.ui.client.widget.Container.add(Container.java:202)
at com.extjs.gxt.ui.client.widget.DataView.add(DataView.java:142)
at com.extjs.gxt.ui.client.binder.DataViewBinder.createAll(DataViewBinder.java:75)
at com.extjs.gxt.ui.client.binder.StoreBinder.init(StoreBinder.java:126)

30 Jun 2008, 11:29 AM
I reviewed the code, and tested the events and see no issues. Are you sure you running the latest code? If you still have problems, post some sample code.

Here is the code I used:

view.addListener(Events.BeforeAdd, new Listener<DataViewEvent>() {
public void handleEvent(DataViewEvent e) {

30 Jun 2008, 11:45 AM
Sorry. My bad. I was using an older version... :">