Answer:
We can prevent Editing in row EditMode by setting args.Cancel as true using OnActionBegin event in Blazor TreeGrid.
<SfTreeGrid DataSource="@TreeGridData" IdMapping="RowId" ParentIdMapping="ParentId" TreeColumnIndex="1" AllowResizing="true" AllowFiltering="false">
<TreeGridEvents TValue="DfRecordEditorRow" OnActionBegin="actionBegin">TreeGridEvents>
<TreeGridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Row" />
<TreeGridColumns>
<TreeGridColumn Field="RowId" HeaderText="Task ID" IsPrimaryKey="true" Width="20" Visible="false">TreeGridColumn>
<TreeGridColumn Field="Name" HeaderText="Task Name" Width="100" AllowResizing="true" AllowEditing="false">TreeGridColumn>
<TreeGridColumn Field="Value" HeaderText="Value" Width="200">TreeGridColumn>
TreeGridColumns>
SfTreeGrid>
@code{
private void actionBegin(ActionEventArgs
args)
{
if (args.RequestType
== Blazor.Grids.Action.BeginEdit)
{
args.Cancel = true; //prevented RowEdit
mode when requestType as BeginEdit
}
}
} |
Find the sample to preventing cell edit in row mode in TreeGrid from here.