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

GridView is not sorting when clicking on columns.

3 Answers 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ole
Top achievements
Rank 1
Ole asked on 01 Jun 2011, 11:16 AM
Hi,

I am having this gridview and when I click on the sort columns the grid get refreshed but no sorting has taken place!!.

<telerik:RadGridView x:Name="radGridViewCombinedPrice"  Width="1300" MaxHeight="650" AutoGenerateColumns="False" AreRowDetailsFrozen="True"
                                                     RowDetailsVisibilityMode="VisibleWhenSelected"  ItemsSource="{Binding Source={StaticResource ddsSamsettverd}, Path=Data}"
                                                     ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                     LoadingRowDetails="radGridViewCombinedPrice_LoadingRowDetails" IsReadOnly="True" Visibility="Visible">
                                    <telerik:RadGridView.Columns>
                                        <!--<telerik:GridViewToggleRowDetailsColumn></telerik:GridViewToggleRowDetailsColumn>-->
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Serial}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Heiti}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Heiti_E}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur01}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur02}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur03}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur04}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur05}"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Beinn_Kostnadur06}"/>
                                                                                 
                                    </telerik:RadGridView.Columns>
                                           
                                    <telerik:RadGridView.RowDetailsTemplate>
                                        <DataTemplate>
                                            <telerik:RadTabControl Margin="10">
                                                <telerik:RadTabItem Header="{Binding Path=KosmaUIStrings.CmnTxt_Tab_CombinedPrice, Source={StaticResource ResourceWrapper}}">
                                                    <dataFormToolkit:DataForm x:Name="dataformCombinedPrice" AutoEdit="False" MinWidth="700" MaxWidth="1250" HorizontalAlignment="Left"
                                                                              CommandButtonsVisibility="Cancel,Commit,Edit,delete"  DeletingItem="dataformCombinedPrice_DeletingItem"
                                                                              EditEnded="DataForm_EditEnded" CommitButtonContent="Geyma"  CancelButtonContent="Hætta"
                                                                              MouseLeave="DataForm_MouseLeave" BeginningEdit="dataformCombinedPrice_BeginningEdit"
                                                                              EditEnding="dataformCombinedPrice_EditEnding" ScrollViewer.HorizontalScrollBarVisibility="Auto">
                                                        <Grid>
                                                            <Grid.RowDefinitions>
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                                <RowDefinition Height="Auto" />
                                                            </Grid.RowDefinitions>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition  />
                                                                <ColumnDefinition />
                                                            </Grid.ColumnDefinitions>
                                                              
                                                            <dataFormToolkit:DataField  Grid.Column="0" Grid.Row="0" LabelPosition="Auto" LabelStyle="{StaticResource DetailsLabel}">
                                                                <TextBox Text="{Binding Path=Numer, Mode=OneWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top"
                                                                         Style="{StaticResource ReadOnlyField}"/>
                                                            </dataFormToolkit:DataField>
                                                              
                                                            <!--<dataFormToolkit:DataField Grid.Column="0" Grid.Row="1"  LabelPosition="Left" LabelStyle="{StaticResource DetailsLabel}">
                                                                <ComboBox x:Name="cmbBasicCombinedPriceSerial" IsEnabled="True" SelectedValue="{Binding Path=Serial, Mode=TwoWay}"
                                                                          DisplayMemberPath="serials" SelectedValuePath="serials" DropDownOpened="cmbBasicCombinedPriceSerial_DropDownOpened"
                                                                          MinWidth="100" DropDownClosed="DropDownClosed" Loaded="cmbBasicCombinedPriceSerial_Loaded"/>
                                                            </dataFormToolkit:DataField>-->
                                                              
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="1" Grid.Row="2" LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Heiti, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
  
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="0" Grid.Row="2"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Heiti_E, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
                                                              
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="1" Grid.Row="3"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Verklysing, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
                                                              
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="0" Grid.Row="3"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Verklys_E, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
                                                              
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="0" Grid.Row="6"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Aths, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
  
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="1" Grid.Row="6"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Aths_Eng, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" />
                                                            </dataFormToolkit:DataField>
                                                              
                                                            <!--<dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="0" Grid.Row="7"  LabelPosition="Left">
                                                                <TextBox Text="{Binding Path=Crew_Kostn_Uppr01, Mode=OneWay, NotifyOnValidationError=True, ValidatesOnExceptions=True, StringFormat=\{0:N0\}}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" Style="{StaticResource ReadOnlyField}" Language="IS-is"/>
                                                            </dataFormToolkit:DataField>
  
                                                            <dataFormToolkit:DataField LabelStyle="{StaticResource DetailsLabel}" Grid.Column="1" Grid.Row="7"  LabelPosition="Left" Label="Oldest update">
                                                                <TextBox Text="{Binding Path=OldestUpdated, Mode=TwoWay, StringFormat=\{0:d\}}"
                                                                         HorizontalAlignment="Stretch" MaxLength="100" VerticalAlignment="Top" Style="{StaticResource ReadOnlyField}"/>
                                                            </dataFormToolkit:DataField>-->
  
                                                            <!--<dataFormToolkit:DataField Grid.Column="0" Grid.Row="4" LabelStyle="{StaticResource DetailsLabel}"
                                                            LabelPosition="Left" >
                                                    <ComboBox x:Name="cmbUnit" ItemsSource="{Binding UnitList, Source={StaticResource unitListProvider}}" DisplayMemberPath="Eining"
                                                            SelectedValue="{Binding Nr_Eining, Mode=TwoWay}"  SelectedValuePath="Nr" IsEnabled="True"  />
                                                </dataFormToolkit:DataField>-->
                                                        </Grid>
                                                    </dataFormToolkit:DataForm>
                                                </telerik:RadTabItem>
                                                <telerik:RadTabItem Header="{Binding Path=KosmaUIStrings.CmnTxt_Tab_UnitPrice, Source={StaticResource ResourceWrapper}}">
                                                    <StackPanel Orientation="Vertical">
                                                        <Button Content="{Binding Path=KosmaUIStrings.CmnTxt_Btn_AddUnitPrice, Source={StaticResource ResourceWrapper}}" Height="25"
                                                                x:Name="btnAddUnitPrice" Click="btnAddUnitPrice_Click" IsEnabled="False" Width="150" HorizontalAlignment="Left" Margin="10">
                                                        </Button>
                                                        <telerik:RadGridView x:Name="RadgridViewUnitPrice" AutoGenerateColumns="False" MaxWidth="1250" MaxHeight="300"
                                                                             HorizontalAlignment="Left" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                                             ScrollViewer.VerticalScrollBarVisibility="Auto" MouseLeave="RadgridViewUnitPrice_MouseLeave"
                                                                             RowEditEnded="RadgridViewUnitPrice_RowEditEnded"  Deleting="RadgridViewUnitPrice_Deleting"
                                                                             Deleted="RadgridViewUnitPrice_Deleted" >
                                                            <telerik:RadGridView.Columns>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=tbl_Einingarverd.Serial, Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=tbl_Einingarverd.Heiti,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <!--<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Klst, Mode=TwoWay}"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur01,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur02,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur03,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur04,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur05, Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur06,  Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Kostnadur_Uppr01, Mode=OneWay}" IsReadOnly="True"/>
                                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=tbl_Grunnverd_Vinna.tbl_Frumverd_Vinna.Dags_Verds, Mode=OneWay, StringFormat=\{0:d\}}" IsReadOnly="True"/>-->
                                                            </telerik:RadGridView.Columns>
                                                        </telerik:RadGridView>
                                                    </StackPanel>
                                                </telerik:RadTabItem>
                                            </telerik:RadTabControl>
                                        </DataTemplate>
                                    </telerik:RadGridView.RowDetailsTemplate>
                                </telerik:RadGridView>

The Gridview gets bound from  RIA  domaindatasource .  My telerik version is 2011.1.315.1040.

What can cause this behaviour ?.

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 01 Jun 2011, 11:58 AM
Hello Ole,

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. Designing the type to implement IComparable should fix this problem.

Greetings,
Ivan Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 01 Jun 2011, 12:20 PM
HI,

The sort feutures are not disabled, at least the column headers sort arrows moves.(But nothing happens in the gridview) And as I am binding to a ria domaindatasource, it should be able to sort.  I have done that before.

Are these assumptions not correct ?.

Best

Ole
0
Ivan Ivanov
Telerik team
answered on 01 Jun 2011, 02:43 PM
Hi Ole,

Unfortunately I cannot pinpoint the source of this issue having only this xaml code. Would you please send me a simple demo project that replicates the issue, in order to help us provide better support to your case. Please, excuse me for the inconvenience.

Greetings,
Ivan Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Ole
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Ole
Top achievements
Rank 1
Share this question
or