How do I select an item in my listview by the text displayed?
1 Answer, 1 is accepted
0
Georgi Denchev
Telerik team
answered on 16 Feb 2022, 09:56 AM
Hi, Katie,
You can use the dataItems() method to retrieve all listView models. Then you can filter them by a particular field and select only the ones that match the criteria.
$("#select").on("click", function() {
let listView = $("#listView").data("kendoListView");
let products = ["Chai", "Ikura"];
let items = listView.dataItems().filter(function(i) {
return products.indexOf(i.ProductName) !== -1;
});
items.forEach(function(x) {
let element = listView.element.find("[data-uid="+x.uid+"]");
listView.select(element);
});
});