2

你好 Stackoverflow 社区,

我正在使用 ASP.Net MVC Infragistics igGrid。我希望我的网格具有以下行为。如果我向我的 igGrid 添加一条新记录,我希望我的网格的所有属性/列都是可编辑的。

当我想更新我的 igGrid 的记录时,我希望某些属性/列是只读的。我尝试将我的一些列设置为只读。这解决了我的问题

当我想更新记录时。但是当我想添加一条记录时,这些属性现在是只读的。

在此处输入图像描述

有没有办法单独设置只读属性以添加和编辑记录?

非常感谢你的帮助。

在此处输入图像描述

4

2 回答 2

2

这就是我使用的。它也适用于 igTreeGrid。你可以从这里调整它:

editRowStarted: function (evt, ui) {
    console.log("editRowStarted");

    columnsToHide = ["transactionDate", "bankAccountId","distributionDescription"];
    $("tr[data-new-row] td").each(function () {
        for (j = 0; j < columnsToHide.length; j++) {
            var description = $(this).attr('aria-describedBy');
            if (description.indexOf(columnsToHide[j]) > 0) {
                console.log("Hiding : " + description);
                $(this).css('visibility', 'hidden');
            }
        }
    });
},

这是为了隐藏网格/treeGrid 中的一些过滤器。当我在同一个 treeGrid 中有两个实体时使用它:

function hideFilters(filterColumnKeys) {
    $(".ui-iggrid-filterrow td").each(function () {
        for (j = 0; j < filterColumnKeys.length; j++) {
            var description = $(this).attr('aria-describedBy');
            if (description.indexOf(filterColumnKeys[j]) > 0) {
                console.log("Hiding : " + description);
                $(this).css('visibility', 'hidden');
            }
        }
    });
};
于 2016-07-09T06:00:03.627 回答
1

您应该能够应用类似于本文中描述的方法:http: //www.infragistics.com/community/forums/t/90654.aspx

editCellStarting基本上让所有列都可编辑并根据值取消事件ui.columnKey,而不是相反。

于 2016-07-07T15:11:35.303 回答