Telerik sort and filter columns not working

981 views Asked by At

I have a WPF model with a table "table1" composed by "table1_column1", "table1_column2" and "table1_column3" and another table "table2" composed by "table2_column1", "table2_column2" and "table2_column3".

I have a 0..1 relation from "table1" to "table2", it means that an object from "table1" can be related with 0 or 1 "table2" object.

Now I have create a RadGridView that takes all the table1 objects as ItemsSource. I have the following columns in the RadGridView:

"table1_column1", "table1_column2", "table1_column3", "table2_column1" and everything is working fine, except for two problems: if I try to sort the grid by "table2_column1" or use a filter on "table2_column1", no entry is shown in the table, just the headers.

Sorting and filtering on "table1_column1", "table1_column2" and "table1_column3" work fine. Here is the RadGridView code.

    <telerik:RadGridView.Columns>

        <telerik:GridViewDataColumn x:Name="table1_column1" Header="table1_column1" DataMemberBinding="{Binding Path=table1_column1}" IsReadOnly="true"/>
        <telerik:GridViewDataColumn x:Name="table1_column2" UniqueName ="table1_column2" Header="table1_column2" DataMemberBinding="{Binding Path=table1_column2}" IsReadOnly="true" Width="100" IsAutoGenerated="False"/>
        <telerik:GridViewDataColumn x:Name="table1_column3" Header="table1_column3" DataMemberBinding="{Binding Path=table1_column3}" IsReadOnly="true"/>
        <telerik:GridViewDataColumn x:Name="table2.table2_column1" Header="table2_column1" DataMemberBinding="{Binding Path=table2_column1}" IsReadOnly="true"/>

    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Any suggestion?

1

There are 1 answers

0
Iain Holder On

If the data disappears in a RadGridView when sorting or filtering, it's usually a problem with the comparison of objects. Switch on all .net exceptions and it should become clear where the exception is being thrown.

Debug -> Exceptions -> Common Language Runtime Exceptions = true