2

Hello Stackoverflow community,

I'm using an ASP.Net MVC Infragistics igGrid. I want my grid to have following behavior. If I add a new record to my igGrid, I want all my attributes / columns of my grid to be editable.

When I want to update a record of my igGrid, I want some attributes / columns to be readonly. I have tried setting some of my columns to read only. This solved my problem

when i want to update a record. But when I want to add a record, theses attributes are now readonly.

enter image description here

Is there a way to set the read only attributes separately for adding and editing a record?

thank you very much for the help.

enter image description here

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
Adrian
  • 35
  • 3

2 Answers2

2

This is what I use.It works with igTreeGrid too. You can tweak it from here on :

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

This is for hiding some of the filters in a grid/treeGrid. I use it when I have two entities in the same 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');
            }
        }
    });
};
Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
Ognyan Dimitrov
  • 6,026
  • 1
  • 48
  • 70
1

You should be able to apply an approach similar to what's described in this post: http://www.infragistics.com/community/forums/t/90654.aspx

Basically leave all columns editable and cancel the editCellStarting event based on the ui.columnKey value, rather than the other way around.

Damyan Petev
  • 1,585
  • 7
  • 10