添加超链接onClick的超链接在extJs
答
您可以使用grids cellclick事件来拦截链接点击并执行其他操作。
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()方法中止链接点击事件是很重要的。