Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2745
Unset Column from ReadOnly at runtime
posted

Hey there,

During the MVC construction of the grid, I have a column called "Classification" that is readonly.  I also subscribe to the event 'iggridupdatingeditcellstarting' to make runtime decisions about the editors.  Well a new scenario came up where depending on one of the conditions from another column, the "Classification" will need to have the property of readonly set to false instead of true which was originally set during the page rendering.

I can grab the data of the grid, but then I have to drill into the set of options to switch the value and is wondering if there is a more elegant or object oriented way of doing this:

$('.selector').on('iggridupdatingeditcellstarting', function (e, ui) {
    var options = $(ui.owner.element).data('igGrid').options;

    options.features[0].columnSettings[6].readonly = false; // columnSettings[6] = 'Classification'
}

Since this column's readonly property is set to true, it will not raise the 'iggridupdatingeditcellstarting' event for that editor.  But I want it too.  Typically it won't just under certain conditions but I'm having trouble with the API in making it do what I want.

In razor it is set from the Grid's Updating Feature, then under Column Setting the column is referenced by its key then marked as readonly.

Thanks,