Skip to content

Commit ebe7309

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

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
@@ -388,6 +388,16 @@ private void ApplyFiltering(bool maintainPosition = false)
388388
_currentPage = 0;
389389
}
390390
RaiseAllChanged();
391+
392+
if (maintainPosition && _filtered.Any())
393+
{
394+
_currentPage = Math.Clamp(oldFirstItemIndex / _pageSize, 0, TotalPages - 1);
395+
}
396+
else
397+
{
398+
_currentPage = 0;
399+
}
400+
RaiseAllChanged();
391401
}
392402

393403
private static string WildcardToRegex(string pattern)

0 commit comments

Comments
 (0)