1

我在我的网格中添加了一个动作列,我试图在推送它时获取一个网格值。

这是我的操作栏:

xtype: 'actioncolumn',
width: 30,
sortable: false,
menuDisabled: true,
items: [{
    icon: 'images/refresh16x16.png',
    scope: this,
    handler: this.onBidHistoryGridlClick
}

这是我的听众:

onBidHistoryGridlClick: function(record, grid, rowIndex){
    alert(grid.getStore().getAt(rowIndex).column_name);
}

这不起作用。

图片

有任何想法吗?

4

2 回答 2

3

您已经在侦听器参数中获得了记录,请使用它!

record.get('column_name')

您可能对自己的尝试很接近,但是您忘记了从存储中获得的是记录,而不是原始数据对象。所以这宁愿是:

grid.getStore().getAt(rowIndex).get('column_name')

更新

您的处理程序的参数错误(检查文档)。这应该是:

onBidHistoryGridlClick: function(view, rowIndex, colIndex, item, e, record){
    alert(record.get('column_name'));
}
于 2013-10-02T11:07:05.400 回答
0

除了@rixo 的回答,您可能需要根据上下文(事件处理程序回调函数)使用“数据”属性:

                handler: function (grid, rowIndex, colIndex) {
                    var rec = grid.getStore().getAt(rowIndex).data;
                    alert(rec.toSource());  // this only works in Mozilla Firefox
                    var rec_col_val = grid.getStore().getAt(rowIndex).data.col_name;
                    alert(rec_col_val);
于 2014-05-01T00:50:59.870 回答