Extjs 从网格中获取值
我在我的网格中添加了一个actioncolumn,当它被推送时,我试图获得一个网格值 这是我的行动专栏:Extjs 从网格中获取值,extjs,Extjs,我在我的网格中添加了一个actioncolumn,当它被推送时,我试图获得一个网格值 这是我的行动专栏: xtype: 'actioncolumn', width: 30, sortable: false, menuDisabled: true, items: [{ icon: 'images/refresh16x16.png', scope: this, handler: this.onBidHistoryGridlClick } 这是我的听众: onBidHisto
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);
}
这不管用
有什么想法吗?您已经在侦听器参数中找到了记录,请使用它
record.get('column_name')
您可能已经完成了自己的尝试,但是您忘记了从存储中获得的是一条记录,而不是一个原始数据对象。所以这应该是:
grid.getStore().getAt(rowIndex).get('column_name')
更新
处理程序的参数有误(请检查)。这应该是:
onBidHistoryGridlClick: function(view, rowIndex, colIndex, item, e, record){
alert(record.get('column_name'));
}
除了@rixo的答案外,您可能还需要根据上下文使用“data”属性(事件处理程序回调函数):
我尝试使用record,但得到一个错误:“uncaughttypeerror:Object[Object Object]没有方法‘get’”。有什么想法吗?
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);