Hello. I'd like to know how to implement virtual scrolling for my ComboBox. I'm using OData for ComboBox's DataSource.
I've tried to use the example (https://demos.telerik.com/kendo-ui/combobox/virtualization) - however i'm stuck. I don't know how to implement a Value Mapper in my WebAPI. In this example it's easy to get the index of some value, which is not loaded yet, because there are no any filters/ordering there. But in my case, i'm using the same OData method for different DataSources, but with different filters/ordering.
So, how can i get the index of some value, if i don't know which filter/ordering was used for the DataSource?
5 Answers, 1 is accepted
I would suggest you first examine our documentation and particularly the valueMapper paragraph: Once you know what the valueMapper is required for, you can check our online demo: Consists the implementation of both the Read Action and the value -> index mapping. If you would like to see another implementation, please refer to out services project, used in the Kendo UI demos:
Regards,
Georgi Krustev
Telerik
Hi, Georgie. Thank you for your reply. I've read all of your links and i still have a question.
I know what the Value Mapper is needed for. It should return the row number of an item, that should be selected in the Combobox. That's Ok. However, to get the row number, i should know the appropriate sequence, in which i should search for the item. But in my case (as i mentioned before), i can not get the appropriate sequence, because i don't know which filter and ordering will be used. I mean different filters could give different rows amount and depending on ordering, the item could be, for example 1-st in the sequence or 1000-th.
You are absolutely right, that the row index will be different when the source in the widget is filtered and/or sorted. What you can do is to send the filter/sort information to your service and based on it to determine the correct row index. Basically, you will need to filter/sort the data and then determine the row index.
You can retrieve the filter/sort expressions using the corresponding datasource API:
- http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-filter
- http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-sort
Regards,
Georgi Krustev
Telerik