Server Filtering
The Kendo UI AutoComplete, the ComboBox, the DropDownList, and the MultiSelect support server-side filtering.
Server filtering enables you to display a subset of data, a reduced portion of the whole dataset, which is returned from the server. The ComboBox supports server filtering by utilizing the serverFiltering
option of the Kendo UI DataSource component.
The approaches for configuring the server filtering functionality of the ComboBox that are demonstrated in this article are identical for configuring the server filtering functionality of the AutoComplete, DropDownList, and MultiSelect components.
For runnable examples on server filtering, refer to the following demos:
- Server Filtering in the ComboBox (Demo)
- Server Filtering in the AutoComplete (Demo)
- Server Filtering in the DropDownList (Demo)
- Server Filtering in the MultiSelect (Demo)
Getting Started
To configure server filtering for the ComboBox, set the serverFiltering
option of the DataSource and define the filter
property of the component. For a runnable example, refer to the demo on server filtering the ComboBox.
To display a subset of data, define a minimum filter length by using the minLength
option of the ComboBox. For example, if you set minLength
to 3
, the ComboBox will not start filtering the dataset until the user enters at least three characters.
When you use server filtering, you can bind the ComboBox only to the selected data item. In this way, you do not need to retrieve the whole dataset when you want to display the selected value or text. This approach boosts the loading time of the component.
To bind the ComboBox to the selected data item only:
- Send the selected value to the server.
- Return only the matching data item.
- Use the
data
callback of the DataSource.
data: function() {
//the selectedValue is used on the server to filter the source and return only the matching data item
return {
selectedValue: $("#[widget id]").data("kendoComboBox").value()
}
}
Known Limitations
The server filtering functionality filters only the source. To page and filter the dataset, use virtualization.