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

Projects
None yet
2 participants
@SergioCrisostomo
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

Show outdated Hide outdated Docs/Interface/HtmlTable.Sort.md
@@ -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.

@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").

@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.

@SergioCrisostomo

SergioCrisostomo Oct 27, 2015

Member

👍 will do

@SergioCrisostomo

SergioCrisostomo Oct 27, 2015

Member

👍 will do

Show outdated Hide outdated Source/Interface/HtmlTable.Sort.js
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.

@anutron

anutron Oct 27, 2015

Member

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

@anutron

anutron Oct 27, 2015

Member

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

SergioCrisostomo added a commit that referenced this pull request Oct 27, 2015

Merge pull request #1332 from SergioCrisostomo/sort-direction
add sort order to onSort function arguments

@SergioCrisostomo SergioCrisostomo merged commit c6a90c3 into mootools:master Oct 27, 2015

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