ext gwt grid event
how do i get a cell value in GridEvent when clicking on a certain row.
I want to vave something like: (look at the Wishful thinking):
grid.addListener(Even开发者_JAVA技巧ts.RowDoubleClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
GridEvent gr = (GridEvent) be;
//Wishful thinking
String cellData = gr.getRow(gr.getRowIndex()).getCellValue("id")
}
});
Thanks...
I suggest use:
var selectedText=grid_plancode.getView().getCell(overRow, overCell).innerText
gr.getGrid().getView().getCell(gr.getRowIndex(),colNum)
If you have a BeanModel linked to the grid you can just do
gr.getModel().get("propertyName")
Another solution is listening for changes to the grid's selection model
grid.getSelectionModel().addListener(Events.SelectionChange,
new Listener<SelectionChangedEvent<ModelData>>() {
public void handleEvent(SelectionChangedEvent<ModelData> be) {
List<ModelData> selection = be.getSelection());
}
});
"selection" would then contain a list of the ModelData objects for the selected row/s can then get the do
modelData.get("propertyName")
on each to get the value.
精彩评论