Fix filtering bug
This commit is contained in:
parent
718d21f6cb
commit
f29dff3386
@ -110,8 +110,8 @@ namespace LibationWinForms.grid
|
||||
|
||||
internal void UpdateGrid(List<LibraryBook> dbBooks)
|
||||
{
|
||||
int visibleCount = bindingList.Count;
|
||||
string existingFilter = syncBindingSource.Filter;
|
||||
Filter(null);
|
||||
|
||||
//Add absent books to grid, or update current books
|
||||
|
||||
@ -150,6 +150,11 @@ namespace LibationWinForms.grid
|
||||
int seriesIndex = bindingList.IndexOf(series);
|
||||
bindingList.Insert(seriesIndex + 1, lb);
|
||||
|
||||
if (series.Liberate.Expanded)
|
||||
bindingList.ExpandItem(series);
|
||||
else
|
||||
bindingList.CollapseItem(series);
|
||||
|
||||
series.NotifyPropertyChanged();
|
||||
}
|
||||
else
|
||||
@ -163,13 +168,6 @@ namespace LibationWinForms.grid
|
||||
}
|
||||
}
|
||||
|
||||
if (bindingList.Count != visibleCount)
|
||||
{
|
||||
//re-filter for newly added items
|
||||
Filter(null);
|
||||
Filter(existingFilter);
|
||||
}
|
||||
|
||||
// remove deleted from grid.
|
||||
// note: actual deletion from db must still occur via the RemoveBook feature. deleting from audible will not trigger this
|
||||
var removedBooks =
|
||||
@ -196,7 +194,8 @@ namespace LibationWinForms.grid
|
||||
//no need to re-filter for removed books
|
||||
bindingList.Remove(removed);
|
||||
|
||||
if (bindingList.Count != visibleCount)
|
||||
Filter(existingFilter);
|
||||
|
||||
VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user