Browse Source

Merge pull request #5610 from sdoroff/datagrid-grouping-bug

Fixed DataGidCollectionView grouping bug
pull/5626/head
Jumar Macato 6 years ago
committed by GitHub
parent
commit
5332e34741
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs

11
src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs

@ -3275,7 +3275,7 @@ namespace Avalonia.Collections
addIndex);
// next check if we need to add an item into the current group
// bool needsGrouping = false;
bool needsGrouping = false;
if (Count == 1 && GroupDescriptions.Count > 0)
{
// if this is the first item being added
@ -3302,7 +3302,7 @@ namespace Avalonia.Collections
// otherwise, we need to validate that it is within the current page.
if (PageSize == 0 || (PageIndex + 1) * PageSize > leafIndex)
{
//needsGrouping = true;
needsGrouping = true;
int pageStartIndex = PageIndex * PageSize;
@ -3340,6 +3340,13 @@ namespace Avalonia.Collections
}
}
// if we need to add the item into the current group
// that will be displayed
if (needsGrouping)
{
this._group.AddToSubgroups(addedItem, false /*loading*/);
}
int addedIndex = IndexOf(addedItem);
// if the item is within the current page

Loading…
Cancel
Save