This is a migrated thread and some comments may be shown as answers.

ComboBox Filtering

1 Answer 504 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Yuan
Top achievements
Rank 1
Yuan asked on 08 Jan 2015, 02:44 AM
Out of the box, the ComboBox supports filter values are startswith, endswith and contains. Our requirement needs a more complex filtering mechanism. Our data source will be something looks like 
[{name: "Pennsylvania State University", id: 1}, {name: "University of Pennsylvania", id: 2}, {name: "Princeton University", id: 3}]
When user enters "penn univ", we want the filter result to be 
[{name: "Pennsylvania State University", id: 1}, {name: "University of Pennsylvania", id: 2}]
This needs a dynamically generated filter like
{ logic: "and",
  filters:[{ field: "name", operator: "contains", value: "penn"},
    { field: "name", operator: "contains", value: "univ"}
  ]
}
Is it possible for us to pass a function which returns such a filter with a dynamically generated filter array inside? Or is it has to be predefined string? If we can, how do we split the user input into string array and pass the parts in as value respectively? 
Is it possible to capture the keyup event of the input, and filter the data source separately?

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Jan 2015, 12:37 PM
Hello Yuan,

You can use the filtering event of the widget. It allows to prevent the started filter action and perform a custom one based on your custom requirements. Refer to the datasource filter method for more details about data filtration.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ComboBox
Asked by
Yuan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or