在extJs中,如何在单击其他超链接时添加超链接。此主超链接是表中单元格的值。
您可以使用网格单元格单击事件来截获链接单击并执行其他操作。
Ext.create('Ext.grid.Panel', {
//[...]
listeners: {
'cellclick': function (iView, iCellEl, iColIdx, iStore, iRowEl, iRowIdx, iEvent) {
iEvent.preventDefault();
var zRec = iView.getRecord(iRowEl);
if (iColIdx === 1) {
alert(zRec.get('name'));
}
}
}
//[...]
});
在事件对象上调用 preventDefault(( 方法以中止链接单击事件非常重要。
以下是完整的示例:
https://fiddle.sencha.com/#view/editor&fiddle/21cg