-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
orderBy mutlitple parameters [fetaure request] #2518
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
Comments
Hi Thanks for the feature request! |
@posva @yyx990803 how about supporting both key and custom sort fn like |
@rhyzx I'd like to but we need to add it as a last parameter in order to be safe from a breaking change 😢 Here's what I've done so far: posva@3a55f3c Edit: I didn't see the commit was already referenced 😮. I thought that didn't work with forks |
@rhyzx About the comparator function I think this should be another filter called |
Thank you for not ignoring this request and all the effort you have put into it! |
@dcrystalj I appreciate you support 😄 . I've been a bit slow and I'm sorry, next time I'll handle a request faster 💪 . As for the custom comparator I think this should be included in another filter named |
It's very nice to have multiple fields to be sorted by the Or maybe change the Thank you! Love vuejs! |
@349989153 Any update on that suggestion? It'd be very welcome in a project I'm working on. |
@janbaykara This may introduce a much more complicated filter for a very specific use case (tables) const sort = this.orders.reduce((sorting, {column, order}) => {
sorting[0].push(column)
sorting[1].push(order)
return sorting
}, [[], []])
return _.orderBy(this.chapters, ...sort)
orders: [
{
column: '_id',
order: 'desc'
},
{
column: 'name',
order: 'asc'
}
] This will lend to: |
return _.orderBy(this.chapters, ...sort) I am getting ReferenceError: _ is not defined |
@RSamal You need to include the library in the page or import it if you use a build tool: import _ from 'underscore' Or if you want to use lodash (recommended): import _ from 'lodash' |
it would be really nice to have option for sorting like this
user in users | orderBy 'name' 'lastName'
. if multiple users have same name they get sorted by lastnameThe text was updated successfully, but these errors were encountered: