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

Filtering html characters

3 Answers 382 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 10 May 2017, 03:44 PM

I'm using the kendo grid to filter values which occasionally contain html characters using explicitly defined filters.

When the filter values do not contain html, everything works as expected. However, when the values contain html characters, it causes the filter to return 0 rows when selected. In other words, it does not match any of the values in the grid. I added logic to strip out the html characters before adding to the filters, but this also returns 0 rows.

I tried using Html.Raw() when declaring the custom filter but it didn't have impact on this issue. Is there a way to make the filters handle html properly?

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 12 May 2017, 10:25 AM
Hello Paul,

I was not able to reproduce the same issue on my end.

Please check the following example demonstrating a column with HTML in the filter, and the filter is working as expected:

http://dojo.telerik.com/oLuNa

If I missed an important detail, please modify the example and I will gladly assist.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Dan
Top achievements
Rank 1
answered on 18 May 2017, 07:18 PM
Your example does recreate the issue. If you click the filter icon in the header, the drop down contains "<strong>Jane Doe</strong>" instead of "Jane Doe"
0
Stefan
Telerik team
answered on 22 May 2017, 08:09 AM
Hello Paul,

The mentioned result is expected because the values in the filter chechBox menu are shown as a plain text.

The desired result can be achieved but will require additional custom logic. Separate dataSource have to be used for the filter menu containing only string values:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.filterable.dataSource

Then, on the filter event of the Grid, the default filtering have to be prevented, and based on the values selected from the filter menu, to filter the Grid:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-filter

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-filter

Also, I can suggest submitting a feature request to show the text in the filterMenu formatted as the text in the column:

http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/category/170280-grid?query=UTC

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Dan
Top achievements
Rank 1
Share this question
or