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

added options to sort() and _sort() #1005

Merged
merged 3 commits into from
Jul 23, 2013
Merged

Conversation

rishabhm
Copy link

Fixes #1004

@mridgway
Copy link

Isn't sorting always ascending or descending? It seems like one would only want to modify the comparator in some cases, but the _sort function shouldn't need to be changed. I think the there should be built-in support for descending instead of having to override the _sort function.

@@ -1122,10 +1122,11 @@ Y.ModelList = Y.extend(ModelList, Y.Base, {
@method _sort
@param {Model} a First model to compare.
@param {Model} b Second model to compare.
@param {Object} [options] Options passed from `sort()` function.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably document the options param on the sort() method as well.

@rgrove
Copy link
Contributor

rgrove commented Jul 17, 2013

This looks good, @rishabhm. And I think @mridgway is right. As long as you're in there, do you want to modify _sort() to reverse the comparison if options.descending is truthy?

@ericf
Copy link
Member

ericf commented Jul 17, 2013

This was me that suggested that it should be more abstract :)

@mridgway good point, seems good to have a descensing option baked in.

@ericf
Copy link
Member

ericf commented Jul 19, 2013

@rishabhm thanks! I'll get this merged in now…

@ericf ericf merged commit 26d8652 into yui:dev-master Jul 23, 2013
@ghost ghost assigned ericf Jul 23, 2013
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.

None yet

4 participants