Skip to content

Commit 0de9c6e

Browse files
docs(mccb): update info on virtualization requirements
1 parent 467e72f commit 0de9c6e

File tree

2 files changed

+69
-6
lines changed

2 files changed

+69
-6
lines changed

controls/multicolumncombobox/data-binding/client-side.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The widget only shows data and so only the **Select** settings and `ServiceType`
4444

4545
To bind to a RadClientDataSource instance, set the `ClientDataSourceID` property to the ID of the client data source control.
4646

47-
RadClientDataSource is a wrapper over the Kendo UI DataSource as well. It is a separate control tag that provides some more features (like settings for server filtering or server paging). If you want to use [virtualization]({%slug multicolumncombobox/functionality/virtualization%}), you must use a RadClientDataSource. For all other cases, the built-in `WebServiceSettings` will serve the same purpose.
47+
RadClientDataSource is a wrapper over the Kendo UI DataSource as well. It is a separate control tag that provides some more features pertainig to CRUD operations that are not relevant to the multi-column combo box.
4848

4949
>caption Example 2: Binding to a RadClientDataSource
5050

controls/multicolumncombobox/functionality/virtualization.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,86 @@ Virtualization requires:
1919
* `Height` and `VirtualSettings.ItemHeight` to be set in pixel values.
2020
* All columns to have `Width` set in pixels.
2121
* Remote data binding.
22-
* That the corresponding service provides the paging of the data. This means that a `RadClientDataSource` can be used for virtualization and it requires the following properties:
22+
* That the corresponding service provides the paging of the data. This means that the following properties must be set:
2323
* `PageSize` set according to the `Height` and `ItemHeight` (usually `((Height / ItemHeight) * 4)`)
2424
* `EnableServerFiltering="true"`
2525
* `AllowPaging="true"`
2626
* `EnableServerPaging="true"`
2727

2828
>important RadMultiColumnComboBox is a server-side wrapper over the Kendo UI MultiColumnComboBox widget. The [Virtualization in Kendo DropDowns](https://docs.telerik.com/kendo-ui/controls/editors/combobox/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 RadMultiColumnComboBox.
2929
30-
## Example
30+
## Examples
3131

32-
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.
32+
The following examples show 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.
3333

34-
>caption Example 1: Virtualization in RadMultiColumnComboBox with RadClientDataSource plus a sample value mapper function.
34+
>caption Example 1: Virtualization in RadMultiColumnComboBox. Includes a sample value mapper function
35+
36+
````ASP.NET
37+
<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1" Skin="Default"
38+
39+
EnableServerFiltering="true"
40+
AllowPaging="true"
41+
EnableServerPaging="true"
42+
PageSize="80"
43+
44+
45+
Height="400" Width="300px"
46+
Placeholder="select from the dropdown or type"
47+
DataTextField="ShipName" DataValueField="OrderID"
48+
Filter="Contains" FilterFields="ShipName,ShipCountry">
49+
50+
<WebServiceSettings ServiceType="OData" Select-DataType="JSON">
51+
<Select Url="https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders" />
52+
</WebServiceSettings>
53+
<VirtualSettings ItemHeight="28" ValueMapper="valueMapper" />
54+
55+
<ColumnsCollection>
56+
<telerik:MultiColumnComboBoxColumn Field="OrderID" Title="Order" Width="100" />
57+
<telerik:MultiColumnComboBoxColumn Field="ShipName" Title="Ship" Width="300" />
58+
<telerik:MultiColumnComboBoxColumn Field="ShipCountry" Title="Country " Width="200" />
59+
</ColumnsCollection>
60+
</telerik:RadMultiColumnComboBox>
61+
62+
<script>
63+
function valueMapper(options) {
64+
$telerik.$.ajax({
65+
url: "https://demos.telerik.com/kendo-ui/service/Orders/ValueMapper",
66+
type: "GET",
67+
dataType: "jsonp",
68+
data: convertValues(options.value),
69+
success: function (data) {
70+
options.success(data);
71+
}
72+
})
73+
}
74+
75+
function convertValues(value) {
76+
var data = {};
77+
value = $telerik.$.isArray(value) ? value : [value];
78+
79+
for (var idx = 0; idx < value.length; idx++) {
80+
data["values[" + idx + "]"] = value[idx];
81+
}
82+
83+
return data;
84+
}
85+
</script>
86+
````
87+
88+
You can achieve the same through a RadClientDataSource control. In such a case, you must set the web service settings (including the page size, and enabling the server operations) on the data source control instead of for the multi column combo box.
89+
90+
>caption Example 2: Virtualization in RadMultiColumnComboBox with RadClientDataSource plus a sample value mapper function.
3591
3692
````ASP.NET
3793
<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1" Filter="Contains" Skin="Default"
38-
ClientDataSourceID="RadClientDataSource1" Height="400" Width="100%" Placeholder="select from the dropdown or type"
94+
95+
ClientDataSourceID="RadClientDataSource1"
96+
97+
Height="400" Width="300px" Placeholder="select from the dropdown or type"
3998
DataTextField="ShipName" DataValueField="OrderID">
99+
40100
<VirtualSettings ItemHeight="28" ValueMapper="valueMapper" />
101+
41102
<ColumnsCollection>
42103
<telerik:MultiColumnComboBoxColumn Field="OrderID" Title="Order" Width="100" />
43104
<telerik:MultiColumnComboBoxColumn Field="ShipName" Title="Ship" Width="300" />
@@ -46,10 +107,12 @@ The following example shows how you can use virtualization with the service from
46107
</telerik:RadMultiColumnComboBox>
47108
48109
<telerik:RadClientDataSource
110+
49111
EnableServerFiltering="true"
50112
EnableServerPaging="true"
51113
AllowPaging="true"
52114
PageSize="80"
115+
53116
ID="RadClientDataSource1" runat="server">
54117
<DataSource>
55118
<WebServiceDataSourceSettings ServiceType="OData" Select-DataType="JSON">

0 commit comments

Comments
 (0)