简体   繁体   中英

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

我建议使用:

var selectedText=grid_plancode.getView().getCell(overRow, overCell).innerText
gr.getGrid().getView().getCell(gr.getRowIndex(),colNum)

如果您有一个BeanModel链接到网格,则可以

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM