enable editing for perticular columns which are in non-edit mode, only for newly added rows.

hi,


i have some columns which are non-editable. i achieved this by using allowEditing=false property.
but those non editable columns should editable only for newly added rows.
can you guys please help me to achive the above requirement.

i am using normal edit mode.
this.gridInstance.editSettings={ allowEditing: trueallowDeleting:trueallowAdding: truemode: "Normal" }; 

1 Reply 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team March 15, 2021 12:12 PM UTC

Hi Venkatesh, 

Thanks for the contacting syncfusion support. 

You can achieve your requirement of enable editing to the non-editable columns while adding records in the Grid by setting the allowEditing property as ‘true’ to the required column model in the Grid’s actionBegin event. This is demonstrated in the below code snippet, 

export class NormalEdit extends SampleBase { 
    constructor() { 
       
    } 
// Grid’s actionBegin event handler 
    actionBegin(args) { 
        if (args.requestType === 'add') { 
           
           this.gridInstance.columns[1].allowEditing=true; 
        } 
        else {  
           this.gridInstance.columns[1].allowEditing=false; 
        } 
    } 
   
    render() {  
            <GridComponent dataSource={orderDataSource} ref={grid => this.gridInstance = grid} toolbar={this.toolbarOptions} actionBegin={this.actionBegin.bind(this)}> 
              <ColumnsDirective> 
               . . . 
                <ColumnDirective field='CustomerName' headerText='Customer Name' allowEditing={false} width='150' ></ColumnDirective> 
               . . . 
              </ColumnsDirective> 
            </GridComponent> 
         
      </div>); 
    } 

Please refer the below sample for your reference. 

Please get back to us if you require any further assistance. 


Regards,
Shalini M. 


Marked as answer
Loader.
Up arrow icon