Search by a different value

1 Answer 67 Views
Grid
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Lee asked on 02 Feb 2022, 06:47 PM | edited on 02 Feb 2022, 06:48 PM

I have a grid and I added a search to the toolbar using toolbar: ["search"]. My datasource has a field called eventType that returns an integer corresponding to an event's type. Since the number means nothing to an end user I am using the item template to convert the number to a text string. How would a user use the toolbar's search field to search by that text string rather than the number? For example, type in "concert" and you should get events with type 1. 

Here is a dojo: https://dojo.telerik.com/@dojolee/UWaVOtoY

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Feb 2022, 09:47 AM

Hello Lee,

The search panel functionality applies filter expression on the data source associated with the grid. The content in the template is existent only in the HTML and no operations could be done against the values in the template.

The only alternative is to transform the actual data before passing it onto the Grid and avoid the templates. Otherwise, the operations will be applied to the underlying data, not against the template.

Below I am posting a link to the modified Dojo demonstrating how you can transform the data using the schema.parse function of the data source.

https://dojo.telerik.com/uGeTENuD

Regards,
Nikolay
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Answers by
Nikolay
Telerik team
Share this question
or