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
285
How to make a row read-only based on conditions in an editable igGRid?
posted

I have scenario where I need to make few rows in the editable grid to be displayed as read-only based on some conditions. Is there any option to do this in igGrid?

For example when a row's particular column value is equal to 0 then do not allow to edit that row i.e. make that row readonly.

Thanks & Regards,

Manjunath M

Parents
  • 17590
    Offline posted

    Hello Manjunath,

    Thank you for posting in our community.

    What I can suggest for achieving your requirement is handling editRowStarting event of the igGridUpdating feature. This event is cancellable. This means false could be returned and the event is not going to be fired, respectively the row is not going to be editable. My suggestion is to check the vale responsible for editing and if it says that that row should not be edited cancel the event. For example:

     {
                   name: "Updating",
                   enableAddRow: true,
                   editMode: "row",
                   enableDeleteRow: true,
           editRowStarting: function(evt, ui){
        var rowID = ui.rowID,
            editColumnValue = $("#grid").igGrid("getCellValue",rowID, "DisableEdit" );
         if(!editColumnValue){
          return false;
         }
        }

    }

    I am also attaching a working sample that illustrates my suggestion for your reference.

    Please have a look at the provided sample and let me know if you need any further assistance with this matter.

    igGridEditingConditional (2).zip
Reply Children