当用户点击链接jqgrid时显示模态弹出窗口

时间:2014-09-24 05:07:32

标签: javascript jquery jqgrid

    {
        name: 'EmployeeInformation',
        index: 'EmployeeInformation',
        width: 15,
        sortable: true,
        editable: false,
        formatter: 'showlink',
        formatoptions: {
            //show an modal popup
        }
    }

这是我的jqgrid中的表格列。

我想要的是当我点击链接按钮(EmployeeInformation)时,它会显示一个模态弹出窗口。

1 个答案:

答案 0 :(得分:2)

最简单的方法是使用我在the answer中引入的formatter: 'dynamicLink'代替formatter: 'showlink'。它允许您像the demo中一样定义onClick回调(formatoptions: {onClick: function (rowid, iRow, iCol, cellText, e) {alert('clicked in rowId=' + rowId + ', iRow=' + iRow + ', iCol=' + iCol);}})。另见here

另一种方法是使用<span>样式而不是text-decoration: underline; cursor: pointer;来定义<a>,并使用beforeSelectRowonCellSelect来检测列显示相应的模态弹出窗口。有关相应的代码示例,请参阅the answerthis onethis one和其他代码。