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

Issue with sorting when using DomainDataSource

4 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ron
Top achievements
Rank 1
Ron asked on 24 Oct 2012, 06:08 PM
I have a RadGridView that is bound to a DomainDataSource (Order) that has a column defined as follows:

 

 

 

<radGrid:GridViewDataColumn UniqueName="TransportationMode" DataMemberBinding="{Binding Path=TransportationMode.DescModeTransp, Mode=TwoWay}" IsReadOnly="True" IsGroupable="True" Width="Auto" IsVisible="True">

 

 

 

 

<radGrid:GridViewDataColumn.Header>

 

 

 

 

<TextBlock Text="Mode" ToolTipService.ToolTip="Mode" />

 

 

 

 

</radGrid:GridViewDataColumn.Header>

 

 

 

 

</radGrid:GridViewDataColumn>

 


TransportationMode is an entity of type TransportationMode and a property of Order -->   (Order.TransportationMode)  

TransportationMode can be NULL

If I try to sort on the TransportationMode column by clicking in the column header and either all the Orders have a null TransportationMode or the current row before clicking the header has a null TransportationMode then I receive the following error:

Exception:System.InvalidOperationException
Message:Failed to compare two elements in the array.
User Data:
Stack trace:   at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer)
   at System.Collections.Generic.List`1.BinarySearch(T item, IComparer`1 comparer)
   at Telerik.Windows.Data.KeyedCollection.IndexOf(Object value)
   at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
   at Telerik.Windows.Data.QueryableCollectionView.TryRestorePreviousCurrency()
   at Telerik.Windows.Data.QueryableCollectionView.InitializeCurrencyOnRefresh()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal()
   at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer()
   at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.ResumeNotifications()
   at Telerik.Windows.Controls.DomainServices.DomainServiceCollection`1.OnLoadOperationCompleted(LoadOperation`1 loadOperation)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Inner Exception:System.NullReferenceException
Message:Object reference not set to an instance of an object.
User Data:
Stack trace:   at lambda_method(Closure , Orders )
   at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item)
   at Telerik.Windows.Data.FunctionComparer.Compare(Object x, Object y)
   at System.Collections.Generic.ArraySortHelper`1.InternalBinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)


Can you please help?

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 25 Oct 2012, 06:20 AM
Hello,

 Can you post the grid settings as well? What's is your grid version? Is it our latest official Q3 2012? Can you clarify also if this is regular DomainDataSource or RadDomainDataSource?

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ron
Top achievements
Rank 1
answered on 25 Oct 2012, 12:49 PM

Rad Domain Data Source

 

 

 

 

<radDomain:RadDomainDataSource x:FieldModifier="public" x:Name="OrdersDomainDataSource" QueryName="FindAllOrders" AutoLoad="False" DataContext="{Binding}">

 

 

 

 

 

 

 

 

<radDomain:RadDomainDataSource.DomainContext>

 

 

 

 

 

 

 

 

<mt:OrdersDomainContext/>

 

 

 

 

 

 

 

 

</radDomain:RadDomainDataSource.DomainContext>

 

 

 

 

 

 

 

 

<radDomain:RadDomainDataSource.QueryParameters>

 

 

 

 

 

 

 

 

<radDomain:QueryParameter ParameterName="OrdersHydration" Value="All"/>

 

 

 

 

 

 

 

 

</radDomain:RadDomainDataSource.QueryParameters>

 

 

 

 

 

 

 

 

<radDomain:RadDomainDataSource.SortDescriptors>

 

 

 

 

 

 

 

 

<radData:SortDescriptor Member="DisplayCodeOrders" SortDirection="Ascending"/>

 

 

 

 

 

 

 

 

</radDomain:RadDomainDataSource.SortDescriptors>

 

 

 

 

 

 

 

 

</radDomain:RadDomainDataSource>

 



Grid:

x

 

 

:FieldModifier="public" x:Name="DomainGridView" DomainDataSource="{Binding BindsDirectlyToSource=True, Source={StaticResource OrdersDomainDataSource}}

 


0
Ron
Top achievements
Rank 1
answered on 25 Oct 2012, 01:35 PM
Version is v2011.2.1031
0
Rossen Hristov
Telerik team
answered on 26 Oct 2012, 07:48 AM
Hello,

We believe that we fixed a similar issue a while ago. Can you please try with our latest version 2012 Q3 which was released last week.

If the problem persists, I would like to ask you to send us a runnable dummy sample project that exhibits this behavior so we can debug it at our side and identify the problem.

Thanks in advance.

Kind regards,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Ron
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ron
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or