我有这个带有jqGrid的ASP.Net页面,我想要的只是在网格中添加一个链接列,当按下它时,它会执行一个JavaScript函数,比如在页面中打开一个jQuery对话框...
我能够使用列格式化程序更改第一列以链接coulmn,但我无法使链接执行JavaScript函数...
我的代码:
colModel = [
{ name: 'SR', index: 'SR', width: 90, fixed: true, align: 'center', formatter: 'link', formatoptions: { baseLinkUrl: '#'} },
{ name: 'NextCallBackDate', index: 'NextCallBack', width: 100, fixed: true, align: 'left' }]
答案 0 :(得分:1)
我已经在PHP中完成了这个,但它应该适用于任何地方。准备数据时,请按以下方式更改列:
而不是field='value'
,您可以field='<a onclick="foo(this)">value</a>'
该功能应如下所示:
function foo (item){
alert ($(item).html());
}