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

add sort order to onSort function arguments #1332

Merged
merged 1 commit into from Oct 27, 2015

Conversation

@SergioCrisostomo
Copy link
Member

SergioCrisostomo commented Oct 26, 2015

When sorting a table the onSort function does not tell which direction the sort happens.
Following @oskarkrawczyk 's work I made this PR to fix that.

This would make possible to know if if the reversed state is true or false.

fixes #1193

@@ -40,7 +40,7 @@ HtmlTable Method: constructor

### Events

* sort - callback executed when a column is sorted; passed the *tbody* and the index of the column sorted.
* sort - callback executed when a column is sorted; passed the *tbody*, the index of the column sorted and *reversed* to know the sorting direction.

This comment has been minimized.

Copy link
@anutron

anutron Oct 27, 2015

Member

this isn't super clear. I'd do:

sort - callback executed when a column is sorted; passed the *tbody* (Element), the index of the column sorted (Integer) and which direction the table is sorted ("asc" or "desc").

This comment has been minimized.

Copy link
@SergioCrisostomo

SergioCrisostomo Oct 27, 2015

Author Member

👍 will do

this.setRowSort(data, pre);

if (rel) rel.grab(this.body);
this.fireEvent('stateChanged');
return this.fireEvent('sort', [this.body, this.sorted.index]);
return this.fireEvent('sort', [this.body, this.sorted.index, reversed]);

This comment has been minimized.

Copy link
@anutron

anutron Oct 27, 2015

Member

and then this would be reversed ? 'desc' : 'asc'

@SergioCrisostomo SergioCrisostomo force-pushed the SergioCrisostomo:sort-direction branch from 2393a97 to 58c256c Oct 27, 2015
SergioCrisostomo added a commit that referenced this pull request Oct 27, 2015
add sort order to onSort function arguments
@SergioCrisostomo SergioCrisostomo merged commit c6a90c3 into mootools:master Oct 27, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.