Skip to content

Commit 7e99de4

Browse files
Merge grid-selecteditems-2542 into production (#2547)
* docs(grid): Improve selection documentation * docs(TreeList): Improve Selection documentation --------- Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent 79340f8 commit 7e99de4

File tree

6 files changed

+24
-38
lines changed

6 files changed

+24
-38
lines changed

components/grid/selection/cells.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ To enable cell selection:
9191

9292
You can respond to user selection actions through the `SelectedCellsChanged` event. The event handler receives a collection of type `IEnumerable<GridSelectedCellDescriptor>`. The collection may have multiple, single, or no objects in it, depending on the `SelectionMode` and the last user selection.
9393

94+
> The `SelectedCellsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug grid-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug grid-events%}#onrowdoubleclick) event instead.
95+
9496
>caption Using the Grid SelectedCellsChanged event
9597
9698
````CSHTML
@@ -170,10 +172,6 @@ You can respond to user selection actions through the `SelectedCellsChanged` eve
170172
}
171173
````
172174

173-
### SelectedCellsChanged and Asynchronous Operations
174-
175-
The `SelectedCellsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug grid-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug grid-events%}#onrowdoubleclick) event instead.
176-
177175
## GridSelectedCellDescriptor
178176

179177
The `GridSelectedCellDescriptor` type exposes the following properties:

components/grid/selection/overview.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@ The Grid component supports row and cell selection. When you select a row or a c
2020

2121
## Enable Row or Cell Selection
2222

23-
You can configure the Grid either for row or cell selection:
24-
25-
* To enable row selection:
26-
* Set the [Grid `SelectionMode` parameter](#use-single-or-multiple-selection) or
27-
* Add a `<GridSelectionSettings>` tag to the `<GridSettings>` tag, and set the `SelectionType` parameter to `GridSelectionType.Row`.
28-
* Optionally, you can also select rows through the [checkbox column]({%slug components/grid/columns/checkbox%}).
29-
* To enable cell selection:
30-
* Add a `<GridSelectionSettings>` tag to the `<GridSettings>` tag, and set the `SelectionType` parameter to `GridSelectionType.Cell`.
31-
32-
See [Rows Selection Basics]({%slug grid-selection-row%}#basics) and [Cells Selection Basics]({%slug grid-selection-cell%}#basics) for more details.
23+
You can configure the Grid either for row or cell selection. See [Rows Selection Basics]({%slug grid-selection-row%}#basics) and [Cells Selection Basics]({%slug grid-selection-cell%}#basics) for more details and examples.
3324

3425
## Use Single or Multiple Selection
3526

components/grid/selection/rows.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ To select a range of rows, hold the **Shift** key, while clicking on the first a
2020

2121
Check the [Grid Keyboard navigation demo](https://demos.telerik.com/blazor-ui/grid/keyboard-navigation) for detailed information about selecting rows with the keyboard.
2222

23-
You can also render a checkbox column that allows users to select and deselect rows. To use checkbox selection, add a [`GridCheckboxColumn`]({%slug components/grid/columns/checkbox%}) in the `GridColumns` collection of the Grid. The `GridCheckboxColumn` provides [additional configuration settings related to selection]({%slug components/grid/columns/checkbox%}#parameters).
23+
To enable row selection:
24+
25+
1. Define the selection mode through one of the following options:
26+
* Set the [Grid `SelectionMode` parameter]({%slug grid-selection-overview%}#use-single-or-multiple-selection), or
27+
* Add a `<GridSelectionSettings>` tag inside the Grid `<GridSettings>` tag, and set the `SelectionType` parameter to `GridSelectionType.Row`.
28+
1. Set the Grid `SelectedItems` parameter to a collection of type `IEnumerable<TItem>` where `TItem` is the Grid model class. The collection must be initialized in advance.
29+
1. Optionally, add a [checkbox column]({%slug components/grid/columns/checkbox%}) to the `GridColumns` collection of the Grid. The `GridCheckboxColumn` provides [additional configuration settings related to selection]({%slug components/grid/columns/checkbox%}#parameters).
2430

2531
>caption Grid multiple row selection
2632
@@ -78,6 +84,8 @@ You can also render a checkbox column that allows users to select and deselect r
7884

7985
You can respond to user selection actions through the `SelectedItemsChanged` event. The event handler receives a collection of the Grid data model. The collection may have multiple, single, or no items in it, depending on the `SelectionMode` and the last user selection.
8086

87+
> The `SelectedItemsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug grid-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug grid-events%}#onrowdoubleclick) event instead.
88+
8189
>caption Using the Grid SelectedItemsChanged event
8290
8391
````CSHTML
@@ -146,10 +154,6 @@ You can respond to user selection actions through the `SelectedItemsChanged` eve
146154
}
147155
````
148156

149-
### SelectedItemsChanged and Asynchronous Operations
150-
151-
The `SelectedItemsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug grid-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug grid-events%}#onrowdoubleclick) event instead.
152-
153157
## Selection When Data Changes
154158

155159
When the Grid `Data` collection changes, the `SelectedItems` collection has the following behavior:

components/treelist/selection/cells.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ To enable cell selection:
9898

9999
You can respond to user selection actions through the `SelectedCellsChanged` event. The event handler receives a collection of type `IEnumerable<TreeListSelectedCellDescriptor>`. The collection may have multiple, single, or no objects in it, depending on the `SelectionMode` and the last user selection.
100100

101+
> The `SelectedCellsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug treelist-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug treelist-events%}#onrowdoubleclick) event instead.
102+
101103
>caption Using the TreeList SelectedCellsChanged event
102104
103105
````CSHTML
@@ -184,10 +186,6 @@ You can respond to user selection actions through the `SelectedCellsChanged` eve
184186
}
185187
````
186188

187-
### SelectedCellsChanged and Asynchronous Operations
188-
189-
The `SelectedCellsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug treelist-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug treelist-events%}#onrowdoubleclick) event instead.
190-
191189
## TreeListSelectedCellDescriptor
192190

193191
The `TreeListSelectedCellDescriptor` type exposes the following properties:

components/treelist/selection/overview.md

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@ The TreeList component supports row and cell selection. When you select a row or
2020

2121
## Enable Row or Cell Selection
2222

23-
You can configure the TreeList either for row or cell selection:
24-
25-
* To enable row selection:
26-
* Set the [TreeList `SelectionMode` parameter](#use-single-or-multiple-selection) or
27-
* Add a `<TreeListSelectionSettings>` tag to the `<TreeListSettings>` tag, and set the `SelectionType` parameter to `TreeListSelectionType.Row`.
28-
* Optionally, you can also select rows through the [checkbox column]({%slug treelist-columns-checkbox%}).
29-
* To enable cell selection:
30-
* Add a `<TreeListSelectionSettings>` tag to the `<TreeListSettings>` tag, and set the `SelectionType` parameter to `TreeListSelectionType.Cell`.
31-
32-
See [Row Selection Basics]({%slug treelist-selection-row%}#basics) and [Cell Selection Basics]({%slug treelist-selection-cell%}#basics) for more details.
23+
You can configure the TreeList either for row or cell selection. See [Row Selection Basics]({%slug treelist-selection-row%}#basics) and [Cell Selection Basics]({%slug treelist-selection-cell%}#basics) for more details and examples.
3324

3425
## Use Single or Multiple Selection
3526

components/treelist/selection/rows.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ To select a range of rows, hold the **Shift** key, while clicking on the first a
2020

2121
Check the [TreeList Keyboard navigation demo](https://demos.telerik.com/blazor-ui/treelist/keyboard-navigation) for detailed information about selecting rows with the keyboard.
2222

23-
You can also render a checkbox column that allows users to select and deselect rows. To use checkbox selection, add a [`TreeListCheckboxColumn`]({%slug treelist-columns-checkbox%}) in the `TreeListColumns` collection of the TreeList. The `TreeListCheckboxColumn` provides [additional configuration settings related to selection]({%slug treelist-columns-checkbox%}#parameters).
23+
To enable row selection:
24+
25+
1. Define the selection mode through one of the following options:
26+
* Set the [TreeList `SelectionMode` parameter]({%slug treelist-selection-overview%}#use-single-or-multiple-selection), or
27+
* Add a `<TreeListSelectionSettings>` tag to the `<TreeListSettings>` tag, and set the `SelectionType` parameter to `TreeListSelectionType.Row`.
28+
1. Set the TreeList `SelectedItems` parameter to a collection of type `IEnumerable<TItem>` where `TItem` is the TreeList model class. The collection must be initialized in advance.
29+
1. Optionally, add a [checkbox column]({%slug treelist-columns-checkbox%}) to the `TreeListColumns` collection of the TreeList. The `TreeListCheckboxColumn` provides [additional configuration settings related to selection]({%slug treelist-columns-checkbox%}#parameters).
2430

2531
>caption TreeList multiple row selection
2632
@@ -85,6 +91,8 @@ You can also render a checkbox column that allows users to select and deselect r
8591

8692
You can respond to user selection actions through the `SelectedItemsChanged` event. The event handler receives a collection of the TreeList data model. The collection may have multiple, single, or no items in it, depending on the `SelectionMode` and the last user selection.
8793

94+
> The `SelectedItemsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug treelist-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug treelist-events%}#onrowdoubleclick) event instead.
95+
8896
>caption Using the TreeList SelectedItemsChanged event
8997
9098
````CSHTML
@@ -159,10 +167,6 @@ You can respond to user selection actions through the `SelectedItemsChanged` eve
159167
}
160168
````
161169

162-
### SelectedItemsChanged and Asynchronous Operations
163-
164-
The `SelectedItemsChanged` event handler cannot be awaited. To execute asynchronous operations when the user selects rows, use the [`OnRowClick`]({%slug treelist-events%}#onrowclick) or [`OnRowDoubleClick`]({%slug treelist-events%}#onrowdoubleclick) event instead.
165-
166170
## Selection When Data Changes
167171

168172
When the TreeList `Data` collection changes, the `SelectedItems` collection has the following behavior:

0 commit comments

Comments
 (0)