Skip to content

Maintain selected sort option when toggling filters #11849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

shotor
Copy link
Contributor

@shotor shotor commented Mar 8, 2025

In the database health report view:

If you sort by a column, then toggle one of the filters (show excluded, show expired) the user selected sort option is lost.

It tries to reset to sorting by the first column (quality) in ascending order. But that doesn't work either, you need to manually sort again. Or toggle filter again to get the "default sort" to actually take effect.

This PR stores the user sort option and restores it after filtering. Because it seems more like expected behavior from a user perspective.

Also valid is to fix the default sort, so it actually does reset the order when a filter has been toggled.

Screenshots

Old version

Step 1: Sort by score/descending

image

Step 2: Toggle show excluded entries. UI indicates the table is sorted by quality/ascending. But it's not, it's still the previous sort: score/descending.

image

Step 3: Toggle show excluded entries again. Now it's actually reset and displaying quality/ascending

image

New version

Step 1: Sort by score/descending

image

Step 2: Toggle show excluded entries. Sorting is kept to user choice score/descending.

image

Step 3: Toggling show excluded entries again. Sorting is kept to user choice score/descending.

image

Testing strategy

Created multiple passwords with different qualities.

Created expired password.

Exclude a password.

Then toggle and sort in every direction

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

@shotor shotor force-pushed the fix/maintain-sort-toggle-filter branch from 9560e7a to 3f12af5 Compare March 8, 2025 01:37
@droidmonkey droidmonkey added this to the v2.7.11 milestone Mar 11, 2025
@varjolintu varjolintu self-requested a review June 20, 2025 05:55
@varjolintu varjolintu added feature: Reports pr: bugfix Pull request fixes a bug labels Jun 20, 2025
Copy link
Member

@varjolintu varjolintu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation changes the default sorting when opening the Health Report. The current sortByColumn() does 0, Ascending order, but the new function always overrides that with 1, Descending. So the table is now always sorted with a descending name instead of ascending bad password (the first column with lock icon).

It remembers the sorting set by user though.

@droidmonkey droidmonkey force-pushed the fix/maintain-sort-toggle-filter branch from 3f12af5 to bafa34f Compare June 21, 2025 23:29
@droidmonkey droidmonkey dismissed varjolintu’s stale review June 21, 2025 23:30

Corrected this issue

@droidmonkey droidmonkey merged commit 7a5cd61 into keepassxreboot:develop Jun 22, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: Reports pr: bugfix Pull request fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants