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

Kendo Grid filter not working with foreign key column Model

1 Answer 484 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 15 May 2018, 01:54 PM

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?

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 17 May 2018, 10:12 AM
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.
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or