-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
feature: add default_sort_column
configuration option
#3018
feature: add default_sort_column
configuration option
#3018
Conversation
Code Climate has analyzed commit 25c15c4 and detected 0 issues on this pull request. View more on Code Climate. |
Hey guys, feel free to nitpick. Any feedback is welcome! 😄 |
default_sort_column
configuration option
I somehow thought that this would be a configuration on the resource, not app-wide. If we do it like this, then we won't be able to control it resource-wide. What do you think? |
@adrianthedev I totally agree with you! I think I misunderstood the issue ticket because I actually wrote a draft message asking if having it on the resource would be better, but for some reason, I decided not to send it. I should’ve clarified it before getting started, but fortunately, the ticket is small enough that I can just change it to the resource. |
31e1cc7
to
c0c6529
Compare
c0c6529
to
25c15c4
Compare
@adrianthedev I just updated the PR to move the option to the resource level instead! Thanks once again |
No @icaroryan, you understood it right, I wrote it with the global configuration in mind, but I also agree with @adrianthedev's comment, is much more flexible to be configurable at the resource level.
This is a great example of how to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great @icaroryan thanks for the contribution!
Are you up to make the documentation for this PR?
Thank you for your contribution @icaroryan 💪 |
@Paul-Bob, I can take care of the documentation for this one, too. Thanks for creating an issue for it |
Description
This PR adds the ability to customize the default sorting attribute. The sorting column for the index view is
created_at
by default, but now the user can customize that by setting thedefault_sort_column
option in the resource file to the desired default sorting column.We still use
created_at
as the default sorting column if:default_sort_column
is not setdefault_sort_column
is set, but the model doesn't have that columnThis also allow for backwards compatibility.
Fixes #2982
Checklist:
Screenshots & recording (UPDATED)
Screen.Recording.2024-07-19.at.11.49.19.AM.mov
Manual review steps
Tip: You can use the console log to see what column is being used for sorting when fetching the records (or just look at the UI)
created_at
default_sort_column
to another columnManual reviewer: please leave a comment with output from the test if that's the case.