Disable editing for cell based on rowData

Say a column named 'A' is only editable if the rowData has a property 'editable' to be true.

How can I do that in inline edit mode?

Thanks.


1 Reply 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team September 22, 2021 08:19 AM UTC

Hi Jenson,  
  
Thanks for contacting Syncfusion support. 

We have validated your requirement at our end. You can achieve this by using actionBegin event (RequestType as beginEdit) of Grid. 


In that event, you can dynamically change the allowEditing property of particular column based on the row data. Find the below code example and sample for your reference. 



[App.vue] 

 
<template> 
  <div id="app"> 
    <ejs-grid 
      ref="grid" 
      :dataSource="data" 
      :editSettings="editSettings" 
      :toolbar="toolbar" 
      :actionBegin="actionBegin" 
      height="273px" 
    > 
      ----- 
    </ejs-grid> 
  </div> 
</template> 
<script> 
--- 
 
export default { 
  --- 
  methods: { 
    actionBegin: function (args) { 
      if (args.requestType === "beginEdit") { 
        // dynamically enable and disable the editing on column based on row data 
        if (args.rowData.Editable) {  // use your condition as you want 
          this.$refs.grid.$el.ej2_instances[0].getColumnByField("CustomerID").allowEditing = true;  // enable the Editing on column 
        } else { 
          this.$refs.grid.$el.ej2_instances[0].getColumnByField("CustomerID").allowEditing = false; // disable the Editing on column 
        } 
      } 
    }, 
  }, 
}; 
</script> 
 



Please get back to us if you need further assistance with this. 

Regards,  
Rajapandiyan S 


Marked as answer
Loader.
Up arrow icon