I'd like to highlight the text a user has typed in any matching elements from the filtered list. I don't see any arguments available to the template function that indicate this. Am I overlooking something?
1 Answer, 1 is accepted
answered on 19 Mar 2019, 07:58 AM
You're not missing anything, Ryan. A template is largely independent of the widget that uses it, it relies on the data item that is passed to it only.
You could add a function in it that looks for the widget instance and uses its input field to get its value, but that would make a template dependable on the widget, and at the moment, there is no such built-in provision. Perhaps another option would be to weigh down the data item that is passed to it with an identifier for the widget, but that ties the data to the presentation, which is, again, not the best of practices.
Another approach you can consider is to modify the DOM of the currently visible items in a small timeout through the filtering event - it will give you the current filter, and you can try a DOM manipulation similar to the one shown in this article (although written for another product it showcases how looping the items and using regex can be used to change styling).
If you do create such an example, I'd encourage you to post it here and we'll gladly award your contribution to the community with Telerik points.
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.