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

Search numeric coulmns in search panel

3 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 27 Jan 2020, 08:09 AM

Hello,

is it possible to search numeric columns with the new search panel via built in functionality?

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 29 Jan 2020, 06:35 AM

Hello Martin,

If I understood the question correctly, yes, you can use the search panel to search in columns containing numeric values. Please refer to this small Dojo example for reference.

If that is not exactly what you had in mind, please get back to me with some additional details, and I will happily assist you.

Regards,
Martin
Progress Telerik

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.
0
Martin
Top achievements
Rank 1
answered on 29 Jan 2020, 07:28 AM

Hi Martin,

 

I forgot an important information. I use serverfiltering and the .ToDataSourceResult() method throws an error on my side if I try to search for numeric fields because it can't apply the contains method to a numeric column.

 

Thanks in advance. 

0
Martin
Telerik team
answered on 31 Jan 2020, 07:30 AM

Hello Martin,

The new search panel can be used with all types only with client operations, i.e. -> ServerFiltering(false). What actually happens is that a filter expression for each of the fields is composed and then applied to the data source. This would work on the client-side due to the fact that the values that do not match the value would not throw an error.

However, on the server-side, a strongly-typed environment, the search panel would try filtering numeric and DateTime objects by a string. And this would cause an exception.

Having that said, I would recommend adding only the string columns to the search option.

Another possible approach to filter non-string types on the server is to modify the filters on the server. An example how this could be achieved is available in this forum thread.

Let me know if you have further questions.

Regards,

Author nickname

Progress Telerik

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.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Martin
Telerik team
Martin
Top achievements
Rank 1
Share this question
or