|
1 |
| -/* eslint-disable ember/no-actions-hash, ember/no-classic-classes, ember/no-classic-components, ember/require-tagless-components */ |
| 1 | +/* eslint-disable ember/no-classic-classes, ember/no-classic-components, ember/require-tagless-components */ |
2 | 2 | import Component from '@ember/component';
|
3 |
| -import { computed } from '@ember/object'; |
| 3 | +import { action, computed } from '@ember/object'; |
4 | 4 | import { NavDownIcon } from '../icons/nav-down';
|
5 | 5 | import { NavUpIcon } from '../icons/nav-up';
|
6 | 6 | import { NavUpDownIcon } from '../icons/nav-up-down';
|
@@ -41,25 +41,23 @@ const ThSortable = Component.extend({
|
41 | 41 | }
|
42 | 42 | }),
|
43 | 43 |
|
44 |
| - actions: { |
45 |
| - /** |
46 |
| - Sets the current sorting parameter. |
47 |
| - Note: the current sorting parameter may contain another field than the given field. |
48 |
| - In case the given field is currently sorted ascending, change to descending. |
49 |
| - In case the given field is currently sorted descending, clean the sorting. |
50 |
| - Else, set the sorting to ascending on the given field. |
51 |
| - */ |
52 |
| - inverseSorting() { |
53 |
| - if (this.order === 'asc') { |
54 |
| - this.set('currentSorting', this._inverseSorting(this.currentSorting)); |
55 |
| - } else if (this.order === 'desc') { |
56 |
| - this.set('currentSorting', ''); |
57 |
| - } else { |
58 |
| - // if currentSorting is not set to this field |
59 |
| - this.set('currentSorting', this.dasherizedField); |
60 |
| - } |
61 |
| - }, |
62 |
| - }, |
| 44 | + /** |
| 45 | + Sets the current sorting parameter. |
| 46 | + Note: the current sorting parameter may contain another field than the given field. |
| 47 | + In case the given field is currently sorted ascending, change to descending. |
| 48 | + In case the given field is currently sorted descending, clean the sorting. |
| 49 | + Else, set the sorting to ascending on the given field. |
| 50 | + */ |
| 51 | + inverseSorting: action(function () { |
| 52 | + if (this.order === 'asc') { |
| 53 | + this.set('currentSorting', this._inverseSorting(this.currentSorting)); |
| 54 | + } else if (this.order === 'desc') { |
| 55 | + this.set('currentSorting', ''); |
| 56 | + } else { |
| 57 | + // if currentSorting is not set to this field |
| 58 | + this.set('currentSorting', this.dasherizedField); |
| 59 | + } |
| 60 | + }), |
63 | 61 | });
|
64 | 62 |
|
65 | 63 | export default ThSortable.extend({
|
|
0 commit comments