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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

144045 Apr 16,2019 06:09 AM UTC Apr 22,2019 06:30 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: DataGrid
moez
Asked On April 16, 2019 06:09 AM UTC

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!

Hariharan J V [Syncfusion]
Replied On 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
 


moez
Replied On April 19, 2019 07:52 PM UTC

Thank you Hariharan, That worked perfectly !

Hariharan J V [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon