Adding selection listener to GXT Grid?

thedude19 picture thedude19 · Dec 15, 2010 · Viewed 11.6k times · Source

I'm trying to add a selection listener to my GXT (Ext GWT) Grid, but I can't seem to get it to fire. I've tried many variations of this with no luck:

myGrid.addListener(Events.Select, new SelectionListener<ComponentEvent>() {

     @Override
     public void componentSelected(ComponentEvent ce) {
         System.out.println("selected");
     }
});

Answer

Xi CHEN picture Xi CHEN · Dec 16, 2010
        myGrid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<ModelData>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<ModelData> se) {
            ...

        }
    });

Try this code