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

Foreign Key Column Filter

4 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hannes
Top achievements
Rank 1
Hannes asked on 16 Jul 2018, 02:07 PM

Hi there,

i am using a ForeignKeyEditor in the Grid like this

GridForeignKey.cshtml:

@model object

@(
        Html.Kendo().DropDownListFor(m => m)
            .Filter(FilterType.Contains)
            .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
)

This works however filtering is not working as expected.

If I use the above code the column displays *all* values and not the distinct values that are actually used.

Checking the documentation it states:

By default, the Grid internally matches the values collection in the column with the corresponding value field from the dataItem and creates a collection with the unique values for the filtering of the foreignKey column.

So why is this not working with the above code?

 

4 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 19 Jul 2018, 01:16 PM
Hi Hannes,

I have tested the foreign key column editor on my end but the editor contains only distinct items.

For your convenience I am attaching the sample I used for testing. Please examine it and let me know what I am missing. Have in mind that it will be necessary to restore all references.

I look forward to your reply.


Regards,
Georgi
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.
0
Hannes
Top achievements
Rank 1
answered on 19 Jul 2018, 01:45 PM

Hi Georgi,

your example is for ASP.NET MVC and not ASP.NET MVC CORE.

Please provide a sample which is using Telerik.UI.for.AspNet.Core   

Thank you

 

0
Georgi
Telerik team
answered on 20 Jul 2018, 07:51 AM
Hi Hannes,

I apologize for the inconvenience.

Indeed I sent a MVC sample. However, I have tested the very same configuration in a ASP .Net Core sample and still the editor is populated with the distinct items.

Attached you will find the sample I used for testing. Please examine it and let me know what I am missing.


Regards,
Georgi
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.
0
Hannes
Top achievements
Rank 1
answered on 20 Jul 2018, 09:51 AM

Hello Georgi,

i uploaded a solution to demonstrate my issue - you can find it in my support ticket. 

Please inspect the solution and advise. Also see the attached screenshot.

Kind regards

Tags
Grid
Asked by
Hannes
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Hannes
Top achievements
Rank 1
Share this question
or