在我的 extjs 网格“cutterGrid”中,我有一个具有以下输出的渲染器
<a href="#" class="myclass">Product 1</a>
在我的 Controller 上我有以下内容
'#cutterGrid':{
cellclick :this.onCutterSelectRow
},
这有效,但是,显然这可以点击整行。我只想在特定的单元格上使用它。
这是我网格中的字段
{
xtype:'gridcolumn',
dataIndex:'CutterNumber',
text:'Cutter',
renderer: renderCutter,
flex:1,
sortable: true
},
最佳答案
cellclick 事件将几个参数传递给您的函数 - 其中之一是 EventObject
cellclick( Ext.view.Table this, HTMLElement td, Number cellIndex, Ext.data.Model record, HTMLElement tr, Number rowIndex, Ext.EventObject e, Object eOpts )
在你的函数中,你应该能够这样做:
function onCutterSelectRow(table, td, cellIndex, record, tr, rowIndex, e, eOpts)
{
var target = e.getTarget();
//test HtmlElement target to be your anchor, by class name and element.
}
关于extjs - 如何在 extjs mvc 中将 Controller 事件添加到网格中的 href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10977395/