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: _contentTemplates/common/dropdowns-virtualization.md
+10-19Lines changed: 10 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,59 +5,50 @@ Enabling the UI virtualization feature makes the component reuse a set number of
5
5
#end
6
6
7
7
8
-
9
8
#basics-core
10
9
This section will explain the parameters and behaviors that are related to the virtualization feature so you can set it up.
11
10
12
11
>caption To enable UI virtualization, you need to set the following parameters of the component:
13
12
14
13
*`ScrollMode` - `Telerik.Blazor.DropDownScrollMode` - set it to `DropDownScrollMode.Virtual`. It defaults to the "regular" scrolling.
15
-
16
-
*`PopupHeight` - `string` - set the height of the popup element to a valid CSS unit. It must **not** be a `null/empty` string.
17
-
14
+
*`Height` - `string` - [set the height]({%slug common-features/dimensions%}) in the nested **popup settings** tag of the component. It must **not** be a `null/empty` string.
18
15
*`ItemHeight` - `decimal` - set it to the height each individual item will have in the dropdown. Make sure to accommodate the content your items will have and any item template.
19
-
20
-
*`PageSize` - `int` - defines how many items will actually be rendered and reused. The value determines how many items are loaded on each scroll. The number of items must be large enough according to the `ItemHeight` and `PopupHeight` so that there are more items than the dropdown so there is a scrollbar.
16
+
*`PageSize` - `int` - defines how many items will actually be rendered and reused. The value determines how many items are loaded on each scroll. The number of items must be large enough according to the `ItemHeight` and popup `Height`, so that there are more items than the dropdown so there is a scrollbar.
21
17
22
18
You can find a basic example in the [Local Data](#local-data-example) section below.
23
19
24
20
>caption For working with [remote data](#remote-data-example), you also need:
25
21
#end
26
22
27
23
28
-
29
24
#value-mapper-text
30
-
the component will call this method to request the model that matches the `Value` it has set. This is required because with remote data the `Value` may not be in the initial collection of `Data` that the component has, and so there would otherwise be no way to extract the `DataTextField` from it to render it. Usually, this method will be called on the initial render only to fetch the data item for the current selection.
25
+
the component will call this method to request the model that matches the `Value` it has set. This is required because with remote data the `Value` may not be in the initial collection of data that the component has, and so there would otherwise be no way to extract the `DataTextField` from it to render it. Usually, this method will be called on the initial render only to fetch the data item for the current selection.
31
26
#end
32
27
33
28
34
-
35
29
#remote-data-specifics
36
-
*`OnRead` - `EventCallback` - the component will call this event when the user scrolls with the corresponding offset (`Skip`), `PageSize` and any filters. This lets you optimize the data queries and return only what is needed at the moment, when it is needed.
37
-
38
-
*`TotalCount` - `int` - the total number of items that the dropdown can have. Needs to take into account any current filtering.
30
+
*`OnRead` - `EventCallback` - the component will call this event when the user scrolls with the corresponding offset (`Skip`), `PageSize` and any filters. This lets you optimize the data queries and return only what is needed at the moment, when it is needed. Set the `args.Data` and `args.Total` properties of the event argument object.
39
31
#end
40
32
41
33
42
-
43
34
#limitations
44
-
45
35
* When the initially selected item/items are on a page different than the first one, opening the dropdown list will NOT scroll the list to the selected item.
46
-
47
36
#end
48
37
49
38
50
-
51
39
#remote-data-sample-intro
52
40
This example showcases sample implementations of:
53
41
54
42
* An async remote service that returns the data. It is mocked by a static class for this example, you can refactor as needed, and you can find examples of serializing it over the wire in <ahref="https://github.com/telerik/blazor-ui/tree/master/grid/datasourcerequest-on-server"target="_blank">this collection of sample projects</a> for the grid component - the approach is identical.
55
-
56
43
* An `OnRead` event handler that calls that service.
57
-
58
44
#end
59
45
60
46
61
47
#value-mapper-in-remote-example
62
48
* A `ValueMapper` that also calls the service.
63
-
#end
49
+
#end
50
+
51
+
52
+
#value-in-onread
53
+
>important The `OnRead` handler should change **only the data** of the component, and **not** other parameters such as `Value`. This can lead to issues with the asynchronous nature of the event, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unexpected by the user and cause bad UX.
0 commit comments