views:

220

answers:

2

Hi.

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(Events.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...

A: 
gr.getGrid().getView().getCell(gr.getRowIndex(),colNum)

If you have a BeanModel linked to the grid you can just do

gr.getModel().get("propertyName")
stan229
Thanks, working...
fatnjazzy
A: 

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.

Daniel Vaughan