-
1 May 2009 7:47 AM #1
How to i catch doubleclick event on gxt grid?
How to i catch doubleclick event on gxt grid?
How do i catch double click event in gxt grid?
Here is what i am trying to do it. But double click event never fire this code.
grid.getSelectionModel().addListener(Events.DoubleClick, new Listener<GridEvent>() {
publicvoid handleEvent(GridEvent be) {
MessageBox.alert("Test", "DoubleClick", null);
GridSelectionModel sm = be.grid.getSelectionModel();
}
});
Events.OnDoubleClick also not working.
-
1 May 2009 8:49 AM #2
Code:grid.addListener(Events.CellDoubleClick, new Listener<BaseEvent>(){ public void handleEvent(BaseEvent be) { GridEvent ge = (GridEvent)be; if(ge.colIndex != 0) { //Do something } } });
-
21 Sep 2009 7:31 PM #3
thank you kolli.
Can i get the cell value where i click.?
-
21 Sep 2009 11:50 PM #4
Yes, you can:
The gridEvent has the value attribute.
See if that is the value you are looking for.
Otherwise, you have also the propertyName, and the model.
just do model.get(propertyName).
Also, if still you don't have it there (I guess there was a bug where some things were not getting filled in the gridEvent, not sure if it is fixed already).
The you can do this
ModelData model = yourGrid.getStore().get(gridEvent.rowIndex);
X value = model.get(gridEvent.propertyName)
Hope this helps you.
Regards,
Michel.
-
11 May 2010 8:28 AM #5
Hi, thats work for me... but, I had to put this validation:
GridEvent ge = (GridEvent)be;
if(ge==null)
MessageBox.alert("Grid", "Coming null", null);
else{
txtEntidad.setValue(ge.getModel().get("nombre").toString());
dialogEntidad.hide();
}
Anyway... perfect advice.
-
19 Feb 2011 8:02 AM #6
this could be easier
this could be easier
This could be easier, you don't need casting and could be more safe
grid.addListener(Events.RowDoubleClick, new Listener<GridEvent<BeanModel>>(){
@Override
public void handleEvent(GridEvent<BeanModel> be) {
Window.open("http://google.com", "_blank", null);
}});
-
6 Apr 2011 11:18 PM #7
-
22 Aug 2011 11:53 PM #8
The "Add event handler" command can be used to create event handlers for any of the standard typed events supported by GWT and GXT.
-
11 Nov 2011 11:18 AM #9
slight optimization
slight optimization
Thanks Kolli, you're awesome! Just a small optimization, you can avoid a cast by explicitly using the correct BaseEvent subclass, in this case GridEvent.
Code:grid.addListener(Events.CellDoubleClick, new Listener<GridEvent<Employee>>() { @Override public void handleEvent(GridEvent<Employee> be) { System.out.println(be.getModel().getEmployeeName()); } });
-
4 Feb 2012 5:52 PM #10


Reply With Quote

