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

Filtering complex type column

1 Answer 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SO-SOLUTIONS
Top achievements
Rank 2
SO-SOLUTIONS asked on 14 Dec 2017, 12:03 PM

Hi,

we have a problem with filtering when grid column is binded to the complex type.

Below you can find the makup for the problematic column and DataSource:

columns.Bound(m => m.PaymentMethod.Name).Title("Payment Method").Width(100)
               .Filterable(filterable => filterable.Operators(operators => operators.ForString(str => str.Clear().Contains("contains").IsEqualTo("equals"))));

.DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(true)
        .PageSize(20)
        .Model(model =>
        {
            model.Id(id => id.IdPayment);
            model.Field(m => m.PaymentMethod).DefaultValue(new PaymentMethodViewModel());
            model.Field(m => m.PaymentStatus).DefaultValue(new PaymentStatusViewModel());
        })
        .Read(read => read.Action("Read", "Payments"))
        .Create(create => create.Action("Create", "Payments"))
        .Update(update => update.Action("Update", "Payments"))
        .Destroy(destroy => destroy.Action("Delete", "Payments"))
    )

When we filter for the first time everything works OK, the correct set of data is returned.

But something breaks the filter button. When we clik the filter button for the second time, filter menu window doesn't show up and there is a JS error in console:

 

Błąd mapy źródła: TypeError: this.worker is null
URL zasobu: null
URL mapy źródła: null
[Więcej informacji]
Error: Syntax error, unrecognized expression: [data-field=PaymentMethod.Name]

 

Does Grid for Asp.Net Core supports filtering on complex types?

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Dec 2017, 07:05 AM
Hello, Tomasz,

Thank you for the details.

In general, filtering, sorting, and grouping of complex types are not officially supported as for example the user types "test" and the complex type is {text:"text", value: 10}. This is creating a scenario where the filter tries to match a string with an object.

Still, in this scenario, I can assume that PaymentMethod.Name is a string and the filtering should work as expected:

http://dojo.telerik.com/iLenu/31

Please have in mind that we do recommend flattening that data an ensure that Grid has only flat data.

If the issue still occurs, please provide a runnable example as this will help us inspect it locally and provide a suggestion best suited for it.

Regards,
Stefan
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
SO-SOLUTIONS
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Share this question
or