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

Filtering on a .Include().IncludeNext() field

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 22 Nov 2017, 11:11 PM

Hi - I'm trying to filter a grid that is bound to child tables using .Include() and .IncludeNext() and having no luck. I keep getting the error below - any help would be appreciated, I tried just about everything including gathering up all the SerialNumbers at a higher level but that was flakey code and causing a performance degradation.

Message"Invalid property or field - 'SerialNumber' for type: Invoice"string

Here's my data load statement:

invoices = from inv in _context.Invoices.Include(i => i.ShippingAddress).Include(i => i.InvoiceLines).ThenInclude(s => s.SerialNumbers)    
                       where orgIds.Contains(inv.OwnedBy_Id) select inv;

And my filters:

$("#Grid").data("kendoGrid").dataSource.filter({
            logic: "or",
            filters: [
                {
                    field: "SerialNumber",
                    operator: "contains",
                    value: searchValue
                },

Thanks!
Craig

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 24 Nov 2017, 01:54 PM
Hello Craig,

You need to ensure that you are passing a collection with type containing all of the properties that are bound to the Grid, before calling the ToDataSourceResult method over it. With that in mind, you could try to call the ToList method before calling the ToDataSourceResult, but once again, ensure that you map all properties bound to the grid.

You might also want to take a look at the following forum thread for a discussion about ThenInclude in ASP.NET Core:


Regards,
Konstantin Dikov
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
Craig
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or