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

sort column does not work

4 Answers 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 23 Dec 2011, 06:40 PM
Please have a look at the code below - does it work for you? For some reason the sort column does not work. Thanks


<
Grid >
    <Grid.RowDefinitions>
        <RowDefinition
            Height="*" />
        <RowDefinition
            Height="Auto" />
    </Grid.RowDefinitions>
 
    <decodeHelpers:RadGridViewExt
                x:Name="GridViewMessages"
                Background="White"
                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                AutoGenerateColumns="False"
                IsReadOnly="True"
                ShowColumnFooters="False"
                EnableColumnVirtualization="True"
                EnableRowVirtualization="True"
                VirtualizingStackPanel.VirtualizationMode="Recycling"
                ShowGroupPanel="False"
                Grid.Row="0" CanUserSortColumns="True"
                CanUserFreezeColumns="False"
                RowIndicatorVisibility="Collapsed"
                SelectionMode="Extended"
                SelectionUnit="Cell"
                ClipboardCopyMode="All"
                HierarchyChildTemplate="{StaticResource childGridView}"
                ItemsSource="{Binding Data, ElementName=GridViewDomainDataSource}"
                RowIsExpandedChanging="GridViewMessages_RowIsExpandedChanging">
 
        <decodeHelpers:ContextMenuExtended.ContextMenu>
            <decodeHelpers:ContextMenuExtended x:Name="MessagesContextMenu" Opened="ContextMenu_Opened">
                <decodeHelpers:ContextMenuExtended.Items>
                </decodeHelpers:ContextMenuExtended.Items>
            </decodeHelpers:ContextMenuExtended>
        </decodeHelpers:ContextMenuExtended.ContextMenu>
 
        <decodeHelpers:RadGridViewExt.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" Header="ID" Width="Auto" MinWidth="50" IsFilterable="False"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding MessageTypeID}" Header="Type" Width="Auto" MinWidth="60"/>
 
        </decodeHelpers:RadGridViewExt.Columns>
 
        <decodeHelpers:RadGridViewExt.ChildTableDefinitions>
            <telerik:GridViewTableDefinition/>
        </decodeHelpers:RadGridViewExt.ChildTableDefinitions>
 
    </decodeHelpers:RadGridViewExt>
 
    <telerik:RadDataPager Name="RadDataPagerMessages" Grid.Row="1"
                          Source="{Binding Data, ElementName=GridViewDomainDataSource}"
                          IsTotalItemCountFixed="False" PageSize="50" Margin="0,0,0,4"
                          DisplayMode="All"/>
</Grid>
<riaControls:DomainDataSource  x:Name="GridViewDomainDataSource"
                                      QueryName="GetMessages"
                                      AutoLoad="False"
                                      LoadSize="100"
                                      PageSize="50"
                                      LoadedData="GridViewDomainDataSource_LoadedData">
 
            <riaControls:DomainDataSource.DomainContext>
                <context:SomethingContext/>
            </riaControls:DomainDataSource.DomainContext>
 
        </riaControls:DomainDataSource>

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Dec 2011, 04:04 PM
Hi Alex,

  Such a code works fine at my end.
  By default the sorting feature of RadGridView gets disabled when it is not possible to determine any order for the elements of the respective type. Can your data be sorted on any of the bound 'ID' or 'MessageTypeID' properties?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Alex
Top achievements
Rank 1
answered on 03 Jan 2012, 06:35 PM

thanks for your reply

What do you mean by "Can your data be sorted on any of the bound 'ID' or 'MessageTypeID' properties?" I want users to be able to sort data at any time by clicking at the column header

My domain service returns an ObservableCollection. I wonder if it is anything to do with that?

 

 

 

 

 

0
Alex
Top achievements
Rank 1
answered on 05 Jan 2012, 06:29 PM
I still have this issue. I tried using RadDomainDataSource and my data does not load at all. Could you share the code you tested please?
0
Dimitrina
Telerik team
answered on 06 Jan 2012, 10:12 AM
Hello,

 Please take a look at this forum post where a similar topic is discussed. There is a sample project attached as well.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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