Skip to content

Commit 37c0cac

Browse files
vveesseelliinnaapepinho24
authored andcommitted
docs(mulstiselect): Add Virtualization article
1 parent 88432f2 commit 37c0cac

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

controls/multiselect/functionality/virtualization.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,79 @@ published: True
88
position: 5
99
---
1010

11+
# Virtualization
1112

13+
**RadMultiSelect** supports virtualization of the data and the UI at the same time in order to improve both server and client performance for cases when you have large amounts of data. As the user scrolls through the list of items, new pages of data are requested and the existing DOM elements are reused to render them.
14+
15+
![multiselect-virtualization](../images/multiselect-virtualization.gif)
16+
17+
## Prerequisites
18+
19+
Virtualization requires:
20+
21+
* `DropDownHeight` and `VirtualSettings.ItemHeight` to be set in pixels. If you do not explicitly specify the height of the virtualized list container, the list will use the default height of 200px.
22+
* Remote data binding.
23+
* That the corresponding service provides the paging of the data. This means that the following properties must be set:
24+
* `WebServiceClientDataSource.PageSize` set according to the `DropDownHeight` and `ItemHeight` (usually `((DropDownHeight / ItemHeight) * 4)`)
25+
* `WebServiceClientDataSource.EnableServerFiltering="true"`
26+
* `WebServiceClientDataSource.AllowPaging="true"`
27+
* `WebServiceClientDataSource.EnableServerPaging="true"`
28+
29+
>important RadMultiSelect is a server-side wrapper over the Kendo UI MultiSelect widget. The [Virtualization in Kendo MultiSelect](https://docs.telerik.com/kendo-ui/controls/editors/multiselect/virtualization) article explains in detail how virtualization works in the underlying widgets, and lists its behaviors, specifics and requirements. You should get familiar with it before using virtualization in RadMultiSelect.
30+
31+
## Examples
32+
33+
The following example shows how you can use virtualization with the service from the [Kendo Service repo](https://github.com/telerik/kendo-ui-demos-service). It also includes a [sample value mapper](https://github.com/telerik/kendo-ui-demos-service/blob/master/demos-and-odata-v3/KendoCRUDService/Controllers/OrdersController.cs) function that is optional.
34+
35+
>caption Example 1: Virtualization in RadMultiSelect with a sample value mapper function
36+
37+
````ASP.NET
38+
<telerik:RadMultiSelect runat="server" Width="300px" ID="RadMultiSelect1" Filter="Contains"
39+
DataTextField="ShipName" DataValueField="OrderID" DropDownHeight="520">
40+
<VirtualSettings ItemHeight="26" ValueMapper="valueMapper" />
41+
<WebServiceClientDataSource EnableServerFiltering="true" AllowPaging="true" PageSize="80" EnableServerPaging="true">
42+
<WebServiceSettings ServiceType="OData">
43+
<Select Url="https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders" />
44+
</WebServiceSettings>
45+
</WebServiceClientDataSource>
46+
</telerik:RadMultiSelect>
47+
48+
<script>
49+
var $ = $ || $telerik.$;
50+
jQuery = jQuery || $;
51+
52+
function valueMapper(options) {
53+
$telerik.$.ajax({
54+
url: "https://demos.telerik.com/kendo-ui/service/Orders/ValueMapper",
55+
type: "GET",
56+
dataType: "jsonp",
57+
data: convertValues(options.value),
58+
success: function (data) {
59+
options.success(data);
60+
}
61+
})
62+
}
63+
64+
function convertValues(value) {
65+
var data = {};
66+
value = $telerik.$.isArray(value) ? value : [value];
67+
68+
for (var idx = 0; idx < value.length; idx++) {
69+
data["values[" + idx + "]"] = value[idx];
70+
}
71+
72+
return data;
73+
}
74+
</script>
75+
````
76+
77+
## See Also
78+
79+
* [Live Demo - Virtualization](http://demos.telerik.com/aspnet-ajax/multiselect/virtualization/defaultcs.aspx)
80+
81+
* [Virtualization in Kendo MultiSelect](https://docs.telerik.com/kendo-ui/controls/editors/multiselect/virtualization)
82+
83+
* [Kendo UI MultiSelect Widget API Reference](https://docs.telerik.com/kendo-ui/api/javascript/ui/multiselect)
84+
85+
* [Filtering]({%slug multiselect/functionality/filtering%})
1286

0 commit comments

Comments
 (0)