avo
avo copied to clipboard
Default sort by for resource
Discussed in https://github.com/avo-hq/avo/discussions/2553
Originally posted by krystof-k March 3, 2024 It would be great if it would be possible to set default sorting for a resource, for example something like:
def fields
field :created_at,
as: :date_time,
disabled: true,
sortable: true,
sort_by_default: :desc
end
For index when visiting resource
self.index_query = -> { query.order(created_at: :desc) }
For index when rendered on association
field :users, as: :has_many, scope: -> { query.order(created_at: :desc) }
Picking this up.
Hello @Yash-Git-Hub we decided to go with a global configuration as specified in this issue https://github.com/avo-hq/avo/issues/2982 and it's already assigned to @iamworrell
Let's continue the conversation there.
Closing in favor of https://github.com/avo-hq/avo/issues/2982