Disable row editing with Batch mode edit settings

Hi 

I have treegrid and i want to disable row editing for Rows whos "isParent" property is true. Following are my settings and code, but still it does not work ? is it because of my edit settings as Batch ? 

public editSettings: EditSettingsModel={ allowEditing: true, allowAdding: false, allowDeleting: false, mode: "Batch" };
public selectedRecord:Object={};
public selectionSettings:Object={ type: 'Multiple', mode: 'Row', cellSelectionMode: 'Box' };

(actionBegin)="disableRow($event)"

disableRow(args){
if (args.name === 'actionBegin') {
if (getValue('isParent', args.rowData) === true) {
args.cancel = true;
}
}
}

1 Reply 1 reply marked as answer

PK Padmavathy Kamalanathan Syncfusion Team May 3, 2021 07:25 AM UTC

Hi Parth Rawal, 
 
Thanks for contacting Syncfusion Forums. 
 
Query: Disable row editing with Batch mode edit settings 
 
We suggest you use “cellEdit” event to disable editing for row based on field value for “Batch” edit mode instead of “actionBegin” event. Setting args.cancel to true in cellEdit event will disable editing. 
 
Please check the below code snippet,

 
 
<ejs-treegrid #treegrid [dataSource]='data' idMapping='TaskID' parentIdMapping='parentID' 
[treeColumnIndex]='1' [editSettings]='editSettings' [toolbar]='toolbar' 
 [selectionSettings]='selectionSettings' (cellEdit)='cellEdit($event)'> 
</ejs-treegrid> 
 
  cellEdit(args) { 
    if (args.rowData.isParent == true) { 
      args.cancel = true//prevented RowEditing when`isParent` value is true 
    } 
  } 
 
Please check the below sample, 
 
Please check the below API help documentation, 
 
Kindly get back to us for further assistance. 
 
Regards, 
Padmavathy Kamalanathan 


Marked as answer
Loader.
Up arrow icon