如何在jQGrid行中禁用超链接

问题描述 投票:0回答:1

我正在使用自定义格式化程序在我的网格的一列中创建超链接。

在我的代码中,有些情况下我需要禁用所选行。行禁用按我的意愿工作,但不禁用该行的超链接。我无法选择行,所有其他列值显示为灰色,表示该行已禁用。内容不会改变颜色的唯一列是具有链接的列。

关于如何禁用链接的任何想法?

这是我的loadComplete函数:

    loadComplete: function (data) {

           var ids =jQuery("#list").jqGrid('getDataIDs');

            for(var i=0;i < ids.length;i++){

                var rowId = ids[i];
                var mod = jQuery("#list").jqGrid('getCell',ids[i],'mod');

                if(mod=='y'){

                jQuery("#jqg_list_"+rowId).attr("disabled", true);
                $("#list").jqGrid('setRowData',ids[i],false, {weightfont:'bold',color:'silver'});

                var iCol = getColumnIndexByName.call(this, 'adate');

                $(this).jqGrid('doInEachRow', function (row, rowId, localRowData) {
                    $(row.cells[iCol]).children("a").click(function (e) {
                        e.preventDefault();
                        // any your code here
                        alert("No Good");
                        return false;
                    });
                });

                    }
                }

            }

我希望在列mod = y的所有行中禁用链接

jqgrid hyperlink
1个回答
0
投票

您可以尝试使用onClick格式化程序的dynamicLink回调描述hereherehere。它为您提供最大的灵活性。在onClick回调中,你可以测试像$(e.target).closest("tr.jqgrow").hasClass("not-editable-row")这样的东西,在这种情况下什么都不做。

© www.soinside.com 2019 - 2024. All rights reserved.