Unplanned
Last Updated: 17 Sep 2019 09:28 by ADMIN
Martin Ivanov
Created on: 17 Apr 2019 07:57
Category: GridView
Type: Bug Report
8
GridView: Columns showing properties of a sub class cannot be sorted or filtered

If you have the following model, the columns that show the Test and Date properties (in the derived class) cannot be sorted or filtered.

 

public class RowModel
{
    public int Id { get; set; }
    public Bar FredBar { get; set; }
}
 
public class Fred : Bar
{
    public DateTime Date { get; set; }
    public string Test { get; set; }
}
 
public abstract class Bar
{
    public string Title { get; set; }
    public double Value { get; set; }       
}

<telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" />               
    <telerik:GridViewDataColumn DataMemberBinding="{Binding FredBar.Title}" />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding FredBar.Value}" />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding FredBar.Date}" />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding FredBar.Test}" />
</telerik:RadGridView.Columns>

To work this around, set the IsCustomSorting property of the corresponding columns and implement a custom sorting in the Sorting event of RadGridView.

2 comments
ADMIN
Martin Ivanov
Posted on: 17 Sep 2019 09:28

Hello Eric,

Thank you for the additional feedback.

I am afraid that, this is not included in the current planning. Please follow the feedback item to get notified when its status changes.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
almostEric
Posted on: 16 Sep 2019 13:02

Just a note, the workaround code adds a whole raft of new issues.

Your MVVM model is now broken
The sorting behavior is different from the other columns unless you add additional logic
The biggest issue is that if the bound data changes while the grid is sorted on a column with custom sorting, the grid will not reflect it until the grid is resorted. not good. Really want to see this fixed