fatnjazzy
fatnjazzy

Reputation: 6152

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

Upvotes: 0

Views: 2971

Answers (3)

Yoosaf Abdulla
Yoosaf Abdulla

Reputation: 3978

I suggest use:

var selectedText=grid_plancode.getView().getCell(overRow, overCell).innerText

Upvotes: 1

Daniel Vaughan
Daniel Vaughan

Reputation: 666

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.

Upvotes: 0

stan229
stan229

Reputation: 2607

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

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

gr.getModel().get("propertyName")

Upvotes: 0

Related Questions