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
220
set readonly to disable edit cell value cann't work when updating the igGrid cell value
posted

editCellStarting: function(evt, ui){ 
 ui.editor.igEditor('option', 'readOnly', true);
ui.editor.igEditor("option", "spinOnReadOnly", true);     
 }
I set the the edit cell with readOnly , but cann't work?  It still can edit. How can I set some table cell cann't 
editable that I want.
What is missing that I setted?

Thanks.

Parents
No Data
Reply
  • 23953
    Verified Answer
    Offline posted

    Hello dlkts,

     editCellStarting is cancelable event, so if you want to make the cell read only then you should cancel the event by returning false in the function. Here is the example:

     

    editCellStarting: function (evt, ui) {

    // Test for condition on which to cancel cell editing

    // Here I use columnIndex property. This will disable from editing the first column in the grid.

    if (ui.columnIndex === 0)

    // cancel the editing

    return false;

    }

     

    You can also check which row is edited like this:

     

     editCellStarting: function (evt, ui) {

    if (ui.rowID === 0)

    {

    // Test for condition on which to cancel cell editing

    // Here I use columnIndex property. This will disable from editing the first column in the grid.

    if (ui.columnIndex === 0)

    // cancel the editing

    return false;

    }

    }

     

    We have bunch of properties you can use in editCellStarting event ot fit your needs. Please check our online documentation for details:

    http://help.infragistics.com/jQuery/2011.2/ui.iggridupdating#!events

     

    Hope this helps,

    Martin Pavlov

    Infragistics

Children