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

Sort and filter columns is not working

1 Answer 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 14 Nov 2014, 10:58 AM
Hi,

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 Name="dataGrid1" FrozenColumnCount="10" Margin="0,72,0,12" AllowDrop="True" AutoGenerateColumns="False" EnableColumnVirtualization="True" CanUserSortColumns="True" CanUserResizeColumns="True" CanUserReorderColumns="True" ShowGroupPanel="False" ShowColumnSortIndexes="False" MouseDoubleClick="showDetails">
 
            <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?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 17 Nov 2014, 11:20 AM
Hi,

You say you set RadGridView's ItemsSource to a DataTable. Would you please try setting it to DataTable.DefaultView instead? Does this help?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Marco
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or