We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Read only for existing column, update-able column for new records

Hello

I'd like to set a specific column to read only for existing records, but still allow the user to enter a value for new records.
Is this possible ?

When I set the [allowEditing] property to false on the e-grid-column, the behavior is as expected when editing an existing record, but the text input is disabled when I try to add a new record.

Thanks!

3 Replies

HJ Hariharan J V Syncfusion Team April 17, 2019 09:07 AM UTC

Hi Moez, 
 
Thanks for contacting Syncfusion support. 
 
We suggest you to use `actionBegin` event and in that event use the following code snippets to achieve your requirement, Please refer the below code snippets and documentation link. 
 
function actionBegin(args) { // need to map thie method in grid settings 
        if (args.requestType === 'beginEdit') {   // check the action type        
           grid.getColumns()[1].allowEditing = false; // disable editing for particular column 
        } 
        else if (args.requestType === 'add') {           
           grid.getColumns()[1].allowEditing = true; //grid - grid instance 
        } 
    } 
 
 
Regards,
Hariharan
 



MO moez April 19, 2019 07:52 PM UTC

Thank you Hariharan, That worked perfectly !


HJ Hariharan J V Syncfusion Team April 22, 2019 06:30 AM UTC

Hi Moez, 
 
Thanks for your update.  
  
We are happy to hear that the provided solution helped you.   
  
Please contact us if you need any further assistance. As always, we will be happy to assist you.   
  
Regards, 
Hariharan 


Loader.
Live Chat Icon For mobile
Up arrow icon