[英]Get Grid Cell Value on Hover in ExtJS4
I have the following code in a grid: 我在网格中有以下代码:
var grid = Ext.create('Ext.grid.Panel', {
store: store,
stateful: true,
stateId: 'stateGrid',
columns: [
{
text : 'Job ID',
width : 75,
sortable : true,
dataIndex: 'id'
},
{
text : 'File Name',
width : 75,
sortable : true,
dataIndex: 'filename',
listeners : {
'mouseover' : function(iView, iCellEl,
iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
var zRec = iView.getRecord(iRowEl);
alert(zRec.data.id);
}
}
...etc... ...等等...
I can't figure out how to get the cell value of the first column in the row. 我不知道如何获取行中第一列的单元格值。 I've also tried: 我也尝试过:
var record = grid.getStore().getAt(iRowIdx); // Get the Record
alert(iView.getRecord().get('id'));
Any ideas? 有任何想法吗?
Thanks in advance! 提前致谢!
It's easier than what you have. 它比您拥有的要容易。
Look at the Company column config here for an example- http://jsfiddle.net/qr2BJ/4580/ 在此处查看“ 公司”列配置以获取示例-http: //jsfiddle.net/qr2BJ/4580/
Edit: 编辑:
Part of grid definition code: 网格定义代码的一部分:
....
columns: [
{
text : 'Company',
flex : 1,
sortable : false,
dataIndex: 'company',
renderer : function (value, metaData, record, row, col, store, gridView) {
metaData.tdAttr = 'data-qtip="' + record.get('price') + ' is the price of ' + value + '"';
return value;
}
},
....
You can add a handler instead of a listener. 您可以添加处理程序而不是侦听器。
{
header: 'DETAILS',
xtype:'actioncolumn',
align:'center',
width: 70,
sortable: false,
items: [
{
icon: '/icons/details_icon.png', // Use a URL in the icon config
tooltip: 'Show Details',
handler: function(grid, rowIndex, colIndex) {
var record = grid.getStore().getAt(rowIndex);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.