Filtering html characters

4 posts, 0 answers
  1. Dan
    Dan avatar
    2 posts
    Member since:
    Jan 2012

    Posted 10 May 2017 Link to this post

    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?

  2. Stefan
    Admin
    Stefan avatar
    2893 posts

    Posted 12 May 2017 Link to this post

    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 visualization (charts) and form elements.
  3. Dan
    Dan avatar
    2 posts
    Member since:
    Jan 2012

    Posted 18 May 2017 in reply to Stefan Link to this post

    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"
  4. Stefan
    Admin
    Stefan avatar
    2893 posts

    Posted 22 May 2017 Link to this post

    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.
Back to Top