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,

Parents
No Data
Reply
  • 23953
    Offline posted

     

    Hi Daniel,

    You can set column readOnly property at runtime, but you should carefully pick the right event to do this. editCellStarting is not a good candidate, because it won't fire for "Classification" column. In your case you should chose an event (probably editCellEnded) of the column on which "Classification" column depends. This way you'll get the editCellStarting for "Classification" column.

    It will be good if you provide more information on the column on which "Classification" column depends(for example: dataType, editorType and so on), so I can make a more concrete suggestions on how you can resolve your issue.

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

Children