SfDatagrid Exception when sorting
Hello,
I modified SfDataGrid, so the datagrid assign new ItemsSource of the datagrid, when it sort rows by clicking on datagrid header.
but i updated nuget packages, now it throws exception on line 31 (see attachment):
ItemsSource = l;
I can fill ItemsSource till I click on the header of the datagrid, then it throws following exception:
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Syncfusion.Data.CollectionViewAdv.EndDeferInternal()
at Syncfusion.Data.CollectionViewAdv.EndDefer()
at Syncfusion.Data.CollectionViewAdv.DeferHelper.Dispose(Boolean isDisposing)
at Syncfusion.Data.CollectionViewAdv.DeferHelper.Dispose()
at Syncfusion.Data.CollectionViewAdv.Dispose(Boolean isDisposing)
at Syncfusion.UI.Xaml.Grid.GridQueryableCollectionViewWrapper.Dispose(Boolean isDisposing)
at Syncfusion.Data.CollectionViewAdv.Dispose()
at Syncfusion.UI.Xaml.Grid.SfDataGrid.DisposeViewOnItemsSourceChanged()
at Syncfusion.UI.Xaml.Grid.SfDataGrid.OnItemsSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
at Syncfusion.UI.Xaml.Grid.GridPropertyMetadata.OnDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at Syncfusion.UI.Xaml.Grid.GridPropertyMetadata.OnInternalDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Syncfusion.UI.Xaml.Grid.SfDataGrid.set_ItemsSource(Object value)
at My.Controls.EDataGrid.<fillDataGridAsync>d__19.MoveNext() in D:\Projects\CustomControls\CustomControls\DataGrid\EDataGrid.cs:line 186
I installed this nuget packages: <package id="Syncfusion.Data.WPF46" version="15.1.0.41" targetFramework="net461" />
<package id="Syncfusion.SfGrid.WPF46" version="15.1.0.41" targetFramework="net461" />
<package id="Syncfusion.SfGridCommon.WPF46" version="15.1.0.41" targetFramework="net461" />
<package id="Syncfusion.Shared.WPF46" version="15.1.0.41" targetFramework="net461" />
IDE: Visual studio 2015, 2017
OS: Windows 10 64 bit
Do you know where might be problem?
SIGN IN To post a reply.
4 Replies
OD
Oto Dusek
April 25, 2017 09:10 PM UTC
Sorry attachment doesn't work, so there is source code
public sealed class EDataGrid : SfDataGrid{
SortColumnDescriptions scd = new SortColumnDescriptions();
...
...
private void EDataGrid_SortColumnsChanged(object sender, GridSortColumnsChangedEventArgs e)
{
SortColumnDescriptions = scd;
}
SortColumnDescriptions scd = new SortColumnDescriptions();
...
...
private void EDataGrid_SortColumnsChanged(object sender, GridSortColumnsChangedEventArgs e)
{
SortColumnDescriptions = scd;
}
private void EDataGrid_SortColumnsChanging(object sender, GridSortColumnsChangingEventArgs e)
{
if (e.AddedItems.Any()) {
args.SortColumn = e.AddedItems[0].ColumnName;
args.SortDirection = e.AddedItems[0].SortDirection;
} else {
args.SortDirection = ListSortDirection.Ascending;
}
foreach (var a in e.AddedItems) {
scd.Add(a);
}
foreach (var a in e.RemovedItems) {
scd.Remove(a);
}
fillDataGridAsync();
}
{
if (e.AddedItems.Any()) {
args.SortColumn = e.AddedItems[0].ColumnName;
args.SortDirection = e.AddedItems[0].SortDirection;
} else {
args.SortDirection = ListSortDirection.Ascending;
}
foreach (var a in e.AddedItems) {
scd.Add(a);
}
foreach (var a in e.RemovedItems) {
scd.Remove(a);
}
fillDataGridAsync();
}
private async void fillDataGridAsync() {
var l = await rep.GetPageAsync(args);
ItemsSource = l;
var l = await rep.GetPageAsync(args);
ItemsSource = l;
}
}
}
BR
Balamurugan Rajaraman
Syncfusion Team
April 26, 2017 02:49 PM UTC
Hi Oto
Thank you for contact Syncfusion support
We have checked your query “Exception raised when applying sorting”. We were unable to reproduce the reported issue from our side. We have attached the tested sample for your reference. Could you please revert us by modified the sample to reproduce the reported issue at our end. It will greatly helpful for us to analyze further.
Regards,
Balamurugan R
OD
Oto Dusek
April 27, 2017 07:05 PM UTC
Sorry, I cant reproduce it on other project.
BR
Balamurugan Rajaraman
Syncfusion Team
May 2, 2017 12:43 PM UTC
Hi Oto,
We have analyzed your query and we have created a support incident to track the status of this forum has been created under your account. Please log on to our support website to check for further updates
Regards,
Balamurugan R
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
OD Oto Dusek
- Apr 25, 2017 09:08 PM UTC
- May 2, 2017 12:43 PM UTC