You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/treegrid/editing/cell-editing.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
---
2
2
layout: post
3
-
title: Cell Editing in Blazor Tree Grid Component | Syncfusion
4
-
description: Checkout and learn here all about Cell Editing in Syncfusion Blazor Tree Grid component and much more details.
3
+
title: Cell Editing in Blazor TreeGrid Component | Syncfusion
4
+
description: Checkout and learn here all about Cell Editing in Syncfusion Blazor TreeGrid component and much more details.
5
5
platform: Blazor
6
-
control: Tree Grid
6
+
control: TreeGrid
7
7
documentation: ug
8
8
---
9
9
10
-
# Cell Editing in Blazor Tree Grid Component
10
+
# Cell Editing in Blazor TreeGrid Component
11
+
12
+
In Cell edit mode, double-click a cell to begin editing. After editing, the value is committed to the data source when the edit is saved. To enable **Cell** editing, set [TreeGridEditSettings.Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEditSettings.html#Syncfusion_Blazor_TreeGrid_TreeGridEditSettings_Mode) to Cell and ensure `AllowEditing` is true.
11
13
12
-
In Cell edit mode, when a cell is double clicked, it is changed to edit state. The cell value can be changed and saved to the data source. To enable Cell edit, set the [TreeGridEditSettings.Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEditSettings.html#Syncfusion_Blazor_TreeGrid_TreeGridEditSettings_Mode) as **Cell**.
13
14
14
15
{% tabs %}
15
16
@@ -79,4 +80,6 @@ public class TreeData
79
80
80
81

81
82
82
-
N> Cell edit mode is default mode of editing.
83
+
84
+
N> The default edit mode is Row. To use Cell editing, set EditMode to Cell.
Copy file name to clipboardExpand all lines: blazor/treegrid/editing/column-validation.md
+25-24Lines changed: 25 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,15 @@ layout: post
3
3
title: Column Validation in Blazor TreeGrid Component | Syncfusion
4
4
description: Checkout and learn here all about column validation in Syncfusion Blazor TreeGrid component and much more details.
5
5
platform: Blazor
6
-
control: Tree Grid
6
+
control: TreeGrid
7
7
documentation: ug
8
8
---
9
9
10
10
# Column validation in Blazor TreeGrid Component
11
11
12
-
Column validation allows to validate the edited or added row data and it displays errors for invalid fields before saving data. Tree Grid uses **Form Validator** component for column validation. The validation rules can be set by defining the [TreeGridColumn. ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor~Syncfusion.Blazor.TreeGrid.TreeGridColumn~ValidationRules.html).
12
+
Column validation validates edited or added row data and displays errors for invalid fields before saving. TreeGrid uses the **Form Validator** component for column validation. Define validation rules using the [TreeGridColumn.ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor~Syncfusion.Blazor.TreeGrid.TreeGridColumn~ValidationRules.html) property.
13
+
14
+
N> Prerequisites: To enable CRUD operations in TreeGrid, configure the [TreeGridEditSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor~Syncfusion.Blazor.TreeGrid.TreeGridEditSettings.html) with AllowEditing, AllowAdding, and AllowDeleting as needed. Also, define a column with IsPrimaryKey set to true.
The following image shows column validation errors displayed for the Progress field.
88
91

89
92
90
93
## Custom validation
91
94
92
-
Custom validation allows the users to customize the validations manually according to the user's criteria.
93
-
94
-
Custom validation can be used by overriding the IsValid method inside the class that inherits the Validation Attribute. All the validations are done inside the IsValid method. The same class should be set as a attribute to the specific field property of the tree grid's datasource model class.
95
+
Custom validation enables implementing validations based on application-specific rules.
95
96
96
-
The following sample code demonstrates custom validations implemented in the fields `Duration` and `Priority` .
97
+
Create a validation attribute by inheriting from ValidationAttribute and overriding the IsValid method. Apply the attribute to the corresponding model property in the TreeGrid data source class. The example below applies custom validations to the `Duration` and `Priority`fields.
97
98
98
99
```cshtml
99
100
@using TreeGridComponent. Data;
@@ -206,16 +207,15 @@ namespace TreeGridComponent. Data
206
207
207
208
## Custom validator component
208
209
209
-
Apart from using default validation and custom validation, there are cases where you might want to use your validator component to validate the tree grid edit form. Such cases can be achieved using the `Validator` property of the `TreeGridEditSettings` component which accepts a validation component and inject it inside the `EditForm` of the tree grid. Inside the `Validator` , you can access the data using the implicit named parameter context which is of type [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html).
210
+
In addition to built-in validation and custom attributes, a custom validator component can validate the TreeGrid edit form. Use the `Validator` property of the `TreeGridEditSettings` component to inject a validator component into the edit form. Within the `Validator`, access form state and show messages using the implicit `context` parameter of type [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html).
210
211
211
212
For creating a form validator component you can refer [here](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/?view=aspnetcore-8.0#validator-components).
212
213
213
-
In the below code example, the following things have been done.
214
-
215
-
* Created a form validator component named `MyCustomValidator` which accepts [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html) value as parameter.
216
-
* Used the `MyCustomValidator` component inside the `Validator` property.
217
-
* This validator component will check whether Duration value is in between 0 to 30.
218
-
* Displayed the validation error messages using `ValidationMessage` component.
214
+
In the following example:
215
+
- A custom form validator component named `MyCustomValidator` accepts a [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html) parameter.
216
+
- The `MyCustomValidator` component is used inside the `Validator` property.
217
+
- The validator checks whether the Duration value is between 0 and 30.
218
+
- Validation errors are displayed using the `ValidationMessage` component.
219
219
220
220
{% tabs %}
221
221
@@ -381,15 +381,14 @@ namespace TreeGridComponent. Data
381
381
382
382
{% endtabs %}
383
383
384
-
The output will be as follows.
385
-
384
+
The following image shows a TreeGrid using a custom validator component in a dialog edit form.
386
385

387
386
388
387
## Display validation message using in-built tooltip
389
388
390
-
In the above code example, you can see that `ValidationMessage`component is used, this might be not suitable when using Inline editing or batch editing. In such cases, you can use the in-built validation tooltip to show those error messages by using`ValidatorTemplateContext.ShowValidationMessage(fieldName, IsValid, Message)` method.
389
+
When using inline or batch editing, placing `ValidationMessage`elements in the template may not be ideal. In such cases, use the built-in validation tooltip by calling the`ValidatorTemplateContext.ShowValidationMessage(fieldName, IsValid, Message)` method.
391
390
392
-
Now, HandleValidation method of the MyCustomValidator component would be changed like below.
391
+
The following snippet shows the updated `HandleValidation` method of the `MyCustomValidator` component to display tooltip messages.
The following image shows tooltip-based validation messages for a TreeGrid field.
431
429

432
430
433
431
## Disable in-built validator component
434
432
435
-
`Validator` property can also be used to disable the in-built validator component used by the tree grid. For instance, by default, the tree grid uses two validator components, `DataAnnotationValidator` and an internal [ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_ValidationRules) property, for handling edit form validation. If you are willing to use only the `DataAnnotationValidator`component, then it could be simply achieved by using the `Validator` component inside[TreeGridEditSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor~Syncfusion.Blazor.TreeGrid.TreeGridEditSettings.html).
433
+
The `Validator` property can also disable the built-in validator component used by the TreeGrid. By default, the TreeGrid uses two validator components—`DataAnnotationValidator` and the internal [ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_ValidationRules) property—to handle edit form validation. If only the `DataAnnotationValidator`is required, configure it by using the `Validator` component within[TreeGridEditSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor~Syncfusion.Blazor.TreeGrid.TreeGridEditSettings.html).
436
434
437
435
{% tabs %}
438
436
@@ -511,13 +509,13 @@ namespace TreeGridComponent. Data
511
509
512
510
## Display validation message in dialog template
513
511
514
-
Use the form validation to display a validation message for a column that is not defined in the TreeGrid column.
512
+
Use form validation to display a validation message for a column that is not defined in the TreeGrid column set.
515
513
516
-
You can use the **Validator** property to apply validation rules to fields included in the dialog template, even if those fields are not displayed in the TreeGrid columns.
514
+
The `Validator` property can apply validation rules to fields included in the dialog template even if those fields are not displayed as TreeGrid columns.
517
515
518
-
In the below example, the **TaskName** field is not defined in the TreeGrid column and the validation message for the **TaskName** is displayed in the dialog template.
516
+
In the following example, the `TaskName` field is not defined in the TreeGrid columns, and the validation message for `TaskName` is displayed within the dialog template.
519
517
520
-
N> The validation message for fields that are not defined in the TreeGrid column will be shown as the validation summary (top of the dialog edit form) in the dialogedit form.
518
+
N> For fields not defined as TreeGrid columns, validation messages appear in the validation summary (at the top of the dialogedit form).
521
519
522
520
```cshtml
523
521
@using Syncfusion.Blazor.TreeGrid;
@@ -630,4 +628,7 @@ N> The validation message for fields that are not defined in the TreeGrid column
630
628
631
629
```
632
630
631
+
The following image shows how validation messages can be displayed from a dialog template for fields not defined as columns.
632
+
633
633

Copy file name to clipboardExpand all lines: blazor/treegrid/editing/command-column-editing.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
layout: post
3
-
title: Command Column Editing in Blazor Tree Grid Component | Syncfusion
4
-
description: Checkout and learn here all about Command Column Editing in Syncfusion Blazor Tree Grid component and much more details.
3
+
title: Command Column Editing in Blazor TreeGrid Component | Syncfusion
4
+
description: Checkout and learn here all about Command Column Editing in Syncfusion Blazor TreeGrid component and much more details.
5
5
platform: Blazor
6
-
control: Tree Grid
6
+
control: TreeGrid
7
7
documentation: ug
8
8
---
9
9
10
-
# Command Column Editing in Blazor Tree Grid Component
10
+
# Command Column Editing in Blazor TreeGrid Component
11
11
12
-
The command column provides an option to add CRUD action buttons in a column. This can be defined by the [TreeGridColumn.Commands](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_Commands) property.
12
+
The command column provides built-in CRUD action buttons within a column. Configure it using the [TreeGridColumn.Commands](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_Commands) property.
13
13
14
14
The available built-in command buttons are:
15
15
@@ -96,9 +96,9 @@ public class TreeData
96
96
97
97
## Custom command
98
98
99
-
The custom command buttons can be added in a column by using the [Commands](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_Commands) property of the [TreeGridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html) component and the action for the custom buttons can be defined in the [CommandClicked](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CommandClicked) event.
99
+
Add custom command buttons using the [TreeGridColumn.Commands](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html#Syncfusion_Blazor_TreeGrid_TreeGridColumn_Commands) property of the [TreeGridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridColumn.html) component, and handle actions in the [CommandClicked](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.TreeGridEvents-1.html#Syncfusion_Blazor_TreeGrid_TreeGridEvents_1_CommandClicked) event.
100
100
101
-
The following sample code demonstrates adding custom command in the **Manage Records** column and the `CommandClicked` event which triggers when the command is clicked,
101
+
The following example adds a custom Details button in the **Manage Records** column and handles the action in the **CommandClicked** event.
102
102
103
103
```cshtml
104
104
@using Syncfusion.Blazor.TreeGrid;
@@ -160,5 +160,7 @@ The following sample code demonstrates adding custom command in the **Manage Rec
160
160
}
161
161
```
162
162
163
-
The following image represents the custom command added in the **Manage Records** column of the Tree Grid component,
164
-

163
+
The following image shows a custom command button in the **Manage Records** column of the TreeGrid.
164
+
165
+

0 commit comments