Skip to content
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

feat(Table): add custom sort function to columns #1075

Merged
merged 4 commits into from
Jan 8, 2024
Merged

feat(Table): add custom sort function to columns #1075

merged 4 commits into from
Jan 8, 2024

Conversation

Ragura
Copy link
Contributor

@Ragura Ragura commented Dec 6, 2023

πŸ”— Linked issue

Resolves #1071

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds a sortFn property to table column objects. It takes a function as a value that will be used to compare items during the sorting of table rows. Defaults to the code that is currently used to compare values (<, >, ===). I have tested this new functionality in the playground.

Docs have also been updated.

Note: this is my first real PR, so I'm open to any and all feedback on how to improve as a contributor! If the code smells, a better implementation could be made or I messed up with the creation of this PR, please feel free to say so πŸ™‚

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Dec 6, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui βœ… Ready (Inspect) Visit Preview Jan 2, 2024 10:01am

@benjamincanac benjamincanac changed the title Feat(Table) add custom sort functionality to table columns feat(Table): add custom sort function to columns Jan 2, 2024
@benjamincanac benjamincanac merged commit 4f3af6c into nuxt:dev Jan 8, 2024
2 checks passed
@benjamincanac
Copy link
Member

@Ragura I'm wondering if it wouldn't be better to just call this sort instead of sortFn to match other types like https://github.com/nuxt/ui/blob/dev/src/runtime/types/command-palette.d.ts#L25. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UTable] Support for custom sort function for specific columns
2 participants