|
1 | 1 | --- |
2 | 2 | layout: post |
3 | | -title: Single click editing with Batch mode in Blazor TreeGrid | Syncfusion |
4 | | -description: Learn here all about single click editing with Batch mode in Syncfusion Blazor TreeGrid component and more. |
| 3 | +title: Single click Editing with Batch mode in Blazor TreeGrid | Syncfusion |
| 4 | +description: Learn how to enable single-click cell editing in the Syncfusion Blazor TreeGrid component using Batch mode and EditCellAsync method. |
5 | 5 | platform: Blazor |
6 | | -control: Tree Grid |
| 6 | +control: TreeGrid |
7 | 7 | documentation: ug |
8 | 8 | --- |
9 | 9 |
|
10 | | -# Single click editing with Batch mode in Blazor TreeGrid Component |
| 10 | +# Single Click Editing with Batch Mode in Blazor TreeGrid Component |
11 | 11 |
|
12 | | -A cell is made editable on a single click with a [Batch](https://blazor.syncfusion.com/documentation/treegrid/edit#batch) mode of editing in TreeGrid, by using the [EditCellAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_EditCellAsync_System_Int32_System_String_) method. |
| 12 | +A cell can be made editable with a single click when using [Batch](https://blazor.syncfusion.com/documentation/treegrid/edit#batch) editing mode in the TreeGrid. This is achieved using the [EditCellAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_EditCellAsync_System_Int32_System_String_) method. |
13 | 13 |
|
14 | | -Set the [Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridSelectionSettings.html#Syncfusion_Blazor_TreeGrid_TreeGridSelectionSettings_Mode) property of **TreeGridSelectionSettings** component to **Both** and bind the [CellSelected](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CellSelected) event to Tree Grid. In the [CellSelected](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CellSelected) event handler, call the [EditCellAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_EditCellAsync_System_Int32_System_String_) method based on the clicked cell. |
| 14 | +To implement this: |
| 15 | +- Set the [Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridSelectionSettings.html#Syncfusion_Blazor_TreeGrid_TreeGridSelectionSettings_Mode) property of the **TreeGridSelectionSettings** component to **Both**. |
| 16 | +- Bind the [CellSelected](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CellSelected) event. |
| 17 | +- In the [CellSelected](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CellSelected) event handler, invoke the [EditCellAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_EditCellAsync_System_Int32_System_String_) method based on the clicked cell. |
15 | 18 |
|
16 | 19 | {% tabs %} |
17 | 20 |
|
18 | 21 | {% highlight razor %} |
19 | 22 |
|
20 | 23 | @using TreeGridComponent.Data; |
21 | | -@using Syncfusion.Blazor.Grids; |
22 | | -@using Syncfusion.Blazor.TreeGrid; |
| 24 | +@using Syncfusion.Blazor.Grids; |
| 25 | +@using Syncfusion.Blazor.TreeGrid; |
23 | 26 |
|
24 | 27 | <SfTreeGrid @ref="TreeGrid" DataSource="@TreeGridData" IdMapping="TaskId" ParentIdMapping="ParentId" AllowPaging="true" TreeColumnIndex="1" Toolbar="@(new List<string>() { "Cancel", "Update" })"> |
25 | 28 | <TreeGridEditSettings AllowEditing="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Batch"></TreeGridEditSettings> |
@@ -91,9 +94,8 @@ public class TreeData |
91 | 94 | } |
92 | 95 |
|
93 | 96 | {% endhighlight %} |
94 | | - |
95 | 97 | {% endtabs %} |
96 | 98 |
|
97 | | -The following GIF represents the single click edit performed on the Tree Grid with Edit Mode as "Batch", |
| 99 | +The following GIF represents the single-click edit performed on the TreeGrid with Edit Mode set to "Batch": |
98 | 100 |
|
99 | 101 |  |
0 commit comments