Extjs给gridPanel添加单价双击事件和获取当前行的数据

2023-02-28,,,

有两个小属性,如下

this.on('rowdblclick', this.readContent, this);

this.on('cellclick', this.gridCellClick, this);  //第一个是单机双击事件,触发的事件,第二个是相应的方法,第三个是作用的范围

readContent : function(grid, rowIndex, e) {  //第一个是当前grid,第二个是当前行,第三个是参数
        var rec = grid.getStore().getAt(rowIndex);   //获取当前行的数据
        if (rec == undefined) {
            Ext.Msg.alert("提示", "每次只能且必须查看一条记录");
        }

gridCellClick : function(grid, rowIndex, columnIndex, e) {
        if (columnIndex == 2) {
            this.readContent(grid, rowIndex, e);
        }

}

Extjs给gridPanel添加单价双击事件和获取当前行的数据的相关教程结束。