Kendo Grid filter not working with foreign key column Model

2 posts, 0 answers
  1. George
    George avatar
    1 posts
    Member since:
    Jul 2017

    Posted 15 May 2018 Link to this post

    So I pass in a model list of objects into my view, I reference this in my foreign key column and use filterable.UI to link to a separate function to control the filter. But when I try to do this the grid ignore my .Filterable options and uses the data from my Model.List to populate the filter, this is not the case with a non-foreign key column.

    Does anyone know how to use custom filter options with a foreign key column in a kendo grid?

  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 17 May 2018 Link to this post

    Hi George,

    I responded to your ticket about this problem but I will copy some of the information that I provided there in case other people come to this thread with the same problem.

    When a ForeignKey column is used it internally assigns a values property to the generated column in the Grid JavaScript output (screenshot). When the values property is set to a column, the Grid automatically generates the DropDownList filter UI for the column and the custom filtering UI you try to assign is ignored. 

    It is possible to use the filterMenuInit Grid event to empty the filtering container and add your custom UI, like shown in this KB: Create Filter Widgets with Multiple Filter Criteria in Grid
     
    Anyway, when you want to have both custom filtering and editing UI, rather than that of the foreign key column, it would be easier to replace the ForeignKey column with a regular Bound column and use a ClientTemplate in the Bound column if needed to access the column text from outside the Grid data.

    Regards,
    Tsvetina
    Progress Telerik
    Try our brand new, jQuery-free Angular 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