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/datagrid/cell-selection.md
+3-18Lines changed: 3 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,6 @@ To enable single cell selection:
22
22
- Set the [GridSelectionSettings.Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Mode) property to **Cell**.
23
23
- Set the [GridSelectionSettings.Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Type) property to **Single**.
24
24
25
-
The following example demonstrates how to enable single cell selection using these properties.
26
-
27
25
{% tabs %}
28
26
{% highlight razor tabtitle="Index.razor" %}
29
27
@@ -110,8 +108,6 @@ To enable multiple cell selection:
110
108
- Set the [GridSelectionSettings.Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Mode) property to **Cell**.
111
109
- Set the [GridSelectionSettings.Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Type) property to **Multiple**.
112
110
113
-
The following example demonstrates how to enable multiple cell selection using these properties.
114
-
115
111
{% tabs %}
116
112
{% highlight razor tabtitle="Index.razor" %}
117
113
@@ -199,7 +195,6 @@ The Grid supports three types of cell selection modes, configurable via the [Gri
199
195
2.**Box:** Enables selection of a rectangular range of cells between specified start and end column indexes, including all rows within the defined range. Useful for column-specific selections.
200
196
3.**BoxWithBorder:** Similar to Box, but adds a visual border around the selected cell range for easier identification.
201
197
202
-
203
198
Cell selection requires the [GridSelectionSettings.Mode](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Mode) to be set to **Cell** or **Both**, and the [GridSelectionSettings.Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Type) to be **Multiple**.
204
199
205
200
The following example demonstrates how to dynamically enable and change the `GridSelectionSettings.CellSelectionMode` using a [DropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started-with-web-app).
Single cell selection, multiple cell selection, and range-based cell selection can be performed externally in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid using built-in methods. These APIs allow programmatic interaction with specific cells in the Grid.
301
+
Single cell selection, multiple cell selection, and range-based cell selection can be performed externally in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid using built-in methods. These API's allow programmatic interaction with specific cells in the Grid.
307
302
308
303
### Single cell selection
309
304
310
305
To select a single cell programmatically, use the [SelectCellAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_SelectCellAsync_System_ValueTuple_System_Int32_System_Int32__System_Nullable_System_Boolean__) method. This method selects a cell based on the specified row and column indexes.
311
306
312
-
The following example demonstrates how to select a single cell by retrieving the row and cell indexes from a [NumericTextBox](https://blazor.syncfusion.com/documentation/numeric-textbox/getting-started) and passing them to the `SelectCellAsync` method. When the **Select cell** button is clicked, the specified cell is selected in the Grid.
313
-
314
307
{% tabs %}
315
308
{% highlight razor tabtitle="Index.razor" %}
316
309
@@ -408,8 +401,6 @@ Multiple cell selection in the Syncfusion<sup style="font-size:70%">®</sup>
408
401
409
402
To perform multiple cell selection programmatically, use the [SelectCellsAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_SelectCellsAsync_System_ValueTuple_System_Int32_System_Int32____) method. This method accepts a collection of row and column index pairs to define the target cells.
410
403
411
-
The following example demonstrates how to select multiple cells by calling the `SelectCellsAsync` method within a button click event and passing a collection of row and column indexes as arguments.
412
-
413
404
{% tabs %}
414
405
{% highlight razor tabtitle="Index.razor" %}
415
406
@@ -512,8 +503,6 @@ The Syncfusion<sup style="font-size:70%">®</sup> Blazor DataGrid provides a
512
503
513
504
To retrieve the selected indexes, use the [GetSelectedRowCellIndexesAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_GetSelectedRowCellIndexesAsync) method.
514
505
515
-
The following example demonstrates how to obtain the selected row and cell indexes using the `GetSelectedRowCellIndexesAsync` method and display them in a dialog when a button is clicked.
Clearing cell selection programmatically in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid is useful when you need to remove existing cell selections based on user actions or application logic. This can be achieved using the [ClearCellSelectionAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_ClearCellSelectionAsync) method.
623
612
624
613
The `ClearCellSelectionAsync` method is applicable when the [GridSelectionSettings.Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_Type) property is set to **Multiple** or **Single**.
625
614
626
-
The following example demonstrates how to clear cell selection by invoking the `ClearCellSelectionAsync` method within a button click event.
627
-
628
615
{% tabs %}
629
616
{% highlight razor tabtitle="Index.razor" %}
630
617
@@ -718,8 +705,6 @@ The Syncfusion<sup style="font-size:70%">®</sup> Blazor DataGrid provides mu
718
705
719
706
*[CellDeselected](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridEvents-1.html#Syncfusion_Blazor_Grids_GridEvents_1_CellDeselected): Triggered after a selected cell is deselected. This event can be used to perform actions or cleanup tasks when a cell is no longer selected.
720
707
721
-
In the example below, cell selection is canceled when the **ShipCountry** value is **France** using the `CellSelecting` event. Similarly, cell deselection is canceled when the **OrderID** value is **even** using the `CellDeselecting` event. A notification message is displayed to indicate which event was triggered during cell interaction.
Copy file name to clipboardExpand all lines: blazor/datagrid/checkbox-selection.md
+1-9Lines changed: 1 addition & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,6 @@ documentation: ug
12
12
Checkbox selection in the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid enables to select multiple records using checkboxes rendered in each row. This feature is especially useful for performing bulk actions or operations on selected records.
13
13
To display a checkbox in each Grid row, configure a column with its [Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Type) property set to [CheckBox](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ColumnType.html#Syncfusion_Blazor_Grids_ColumnType_CheckBox).
14
14
15
-
The following example demonstrates how to enable checkbox selection using the `Type` property in the Grid.
> * By default, selection is allowed by clicking either a Grid row or the checkbox in that row. To restrict selection to checkbox clicks only, set the [GridSelectionSettings.CheckboxOnly](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_CheckboxOnly) property to **true**.
90
-
> * To persist selection across Grid operations, enable the [GridSelectionSettings.PersistSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_PersistSelection) property. Ensure that one of the columns is defined as a primary key using the GridColumn.IsPrimaryKey property.
88
+
> * To persist selection across Grid operations, enable the [GridSelectionSettings.PersistSelection](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_PersistSelection) property. Ensure that one of the columns is defined as a primary key using the **GridColumn.IsPrimaryKey** property.
91
89
92
90
## Checkbox selection mode
93
91
@@ -96,8 +94,6 @@ The checkbox selection mode in the Syncfusion<sup style="font-size:70%">®</s
96
94
***Default**: This is the default value of `CheckboxMode`. In this mode, multiple rows can be selected by clicking on them individually. When a row is clicked, its corresponding checkbox is automatically checked.
97
95
***ResetOnRowClick**: In this mode, clicking on a row resets the previously selected row. To perform multiple selections, hold the **Ctrl** key while clicking the desired rows. To select a range of rows, hold the **Shift** key and click the target rows.
98
96
99
-
The following example demonstrates how to dynamically enable and change the `CheckboxMode` using a [DropDownList](https://blazor.syncfusion.com/documentation/dropdown-list/getting-started-with-web-app).
By default, setting the column [Type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_Type) to **CheckBox** renders a checkbox column with a SelectAll checkbox in the header. To hide the header checkbox, define an empty [HeaderTemplate](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_HeaderTemplate) in the [GridColumn](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html).
245
241
246
-
The following example demonstrates how to hide the SelectAll checkbox in the column header using an empty `HeaderTemplate`.
247
-
248
242
{% tabs %}
249
243
{% highlight razor tabtitle="Index.razor" %}
250
244
@@ -325,8 +319,6 @@ public class OrderDetails
325
319
326
320
By default, the Syncfusion<supstyle="font-size:70%">®</sup> Blazor DataGrid allows selection by clicking either a Grid row or the checkbox within that row. To restrict selection so that it can only be performed through checkbox clicks, set the [GridSelectionSettings.CheckboxOnly](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridSelectionSettings.html#Syncfusion_Blazor_Grids_GridSelectionSettings_CheckboxOnly) property to **true**.
327
321
328
-
The following example demonstrates how to enable selection exclusively through checkbox clicks using the `CheckboxOnly` property.
0 commit comments