ExtJs4的grid组件的单击事件
listeners : {
cellclick : function(grid,rowIndex,columnIndex,e ) {
var rec = grid.getStore();
alert(rowIndex);
alert(columnIndex));
Ext.getCmp("formWithGrid").getForm().loadRecord(rec.getAt(rowIndex));
}
}
这是我的单击事件,但是alert出的rowIndex是[Object HTMLTableCellElement],columnIndex是数字,为什么rowIndex不是数字啊?[/size]
------解决方案--------------------请认真看API,是td对象,不是rowindex
cellclick( this,
td, cellIndex, record, tr, rowIndex, e, eOpts )
Fired when table cell is clicked.
Available since: 4.1.0
Parameters
this : Ext.view.Table
td : HTMLElement
The TD element that was clicked.
cellIndex : Number
record : Ext.data.Model
tr : HTMLElement
The TR element that was clicked.
rowIndex : Number
e : Ext.EventObject
eOpts : Object
The options object passed to Ext.util.Observable.addListener.