Skip to content

Commit 312e4ea

Browse files
committed
fix: Fix ApplyFiltering logic and add ResetToFirstPage
1 parent 8b4b177 commit 312e4ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SimpleDataGrid/Pagination/PagedCollection.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,16 @@ private void ApplyFiltering(bool maintainPosition = false)
378378
}
379379

380380
_filtered = query.ToList();
381+
382+
if (maintainPosition && _filtered.Any())
383+
{
384+
_currentPage = Math.Clamp(oldFirstItemIndex / _pageSize, 0, TotalPages - 1);
385+
}
386+
else
387+
{
388+
_currentPage = 0;
389+
}
390+
RaiseAllChanged();
381391
}
382392

383393
private static string WildcardToRegex(string pattern)

0 commit comments

Comments
 (0)