Skip to content

Remove datatable-sort-badge when only one column is sorted #1110

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
merged 2 commits into from
Apr 23, 2025

Conversation

BenjaminCharmes
Copy link
Contributor

@BenjaminCharmes BenjaminCharmes commented Apr 10, 2025

Closes #1108

The numbers always appear when you're in sort-mode="multiple" and prime-vue only removes them when you're in sort-mode="single". This allows the user to know that they can sort several columns at once.

I guess we can find a way of removing the "1" when only one column is sorted, but I couldn't find anything in the prime-vue docs, or even using the custom theme we have in datalab (the two columns have exactly the same css classes), so I had to add another custom css class.

It's a first attempt to see what it could be.

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.35%. Comparing base (c2ccbc3) to head (f88673a).
Report is 98 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1110   +/-   ##
=======================================
  Coverage   71.35%   71.35%           
=======================================
  Files          63       63           
  Lines        4151     4151           
=======================================
  Hits         2962     2962           
  Misses       1189     1189           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BenjaminCharmes BenjaminCharmes changed the title Remove badge when only one datatable column is sorted Remove badge when only one column is sorted Apr 10, 2025
@BenjaminCharmes BenjaminCharmes changed the title Remove badge when only one column is sorted Remove datatable-sort-badge when only one column is sorted Apr 10, 2025
Copy link

cypress bot commented Apr 22, 2025

datalab    Run #3162

Run Properties:  status check passed Passed #3162  •  git commit afbe62a401 ℹ️: Merge f88673ad2864cd862574e01ef312053705979eab into c2ccbc3974a50ef9924d580e21b5...
Project datalab
Branch Review bc/datatable-sorted
Run status status check passed Passed #3162
Run duration 07m 29s
Commit git commit afbe62a401 ℹ️: Merge f88673ad2864cd862574e01ef312053705979eab into c2ccbc3974a50ef9924d580e21b5...
Committer Ben Charmes
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 477
View all changes introduced in this branch ↗︎

@ml-evs ml-evs force-pushed the bc/datatable-sorted branch from 8f1df30 to f88673a Compare April 22, 2025 20:49
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

Having some trouble testing this locally, it seems to work well for the ID column, but I'm getting errors when trying to filter with any of the enum columns (e.g., item type, creators). Does this work for you locally @BenjaminCharmes?

@BenjaminCharmes
Copy link
Contributor Author

Having some trouble testing this locally, it seems to work well for the ID column, but I'm getting errors when trying to filter with any of the enum columns (e.g., item type, creators). Does this work for you locally @BenjaminCharmes?

I've just tried again and everything seems to be working fine for me

Screenshot 2025-04-23 at 09 30 53

Screenshot 2025-04-23 at 09 31 06

@ml-evs
Copy link
Member

ml-evs commented Apr 23, 2025

Having some trouble testing this locally, it seems to work well for the ID column, but I'm getting errors when trying to filter with any of the enum columns (e.g., item type, creators). Does this work for you locally @BenjaminCharmes?

I've just tried again and everything seems to be working fine for me

Screenshot 2025-04-23 at 09 30 53

Screenshot 2025-04-23 at 09 31 06

Ah, I think I'm seeing some unrelated problem then. It also works well when sorting for me, but if I try to add a filter I'm getting a runtime error from the dev server. However, I also see the same error on main now 🙃 so I'll have to look into it...

Uncaught runtime errors:
ERROR
this.filters[this.field] is undefined

EDIT: I think this is perhaps related to the last primevue update that I merged in #1138 -- will see if reverting it helps.

Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

Thanks @BenjaminCharmes, this does seem to work well! I think it would be a good idea to add a couple more tests for the data table component tests for search, sort and filtering (also with up to date example data too with block types, nfiles). I'll raise a separate issue to track this!

@ml-evs ml-evs merged commit 2f6be91 into main Apr 23, 2025
17 checks passed
@ml-evs ml-evs deleted the bc/datatable-sorted branch April 23, 2025 09:40
@ml-evs ml-evs added webapp For issues/PRs pertaining to the web interface visuals For issues/PRs pertaining to visuals/aesthetics of the interface labels Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
visuals For issues/PRs pertaining to visuals/aesthetics of the interface webapp For issues/PRs pertaining to the web interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sample table: Don't display "1" when only one column is sorted
2 participants