2016-07-04 34 views
2

你好社区#1,ASP.Net MVC的Infragistics igGrid - 只读属性更新记录,非只读属性添加一条记录

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

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

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

enter image description here

有没有一种方法来设置只读添加和编辑记录单独的属性?

非常感谢您的帮助。

enter image description here

回答

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。我在同一棵树网格中有两个实体时使用它:

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'); 
      } 
     } 
    }); 
};