github.com/manicqin/nomad@v0.9.5/ui/app/components/list-table/sort-by.js (about) 1 import Component from '@ember/component'; 2 import { computed } from '@ember/object'; 3 4 export default Component.extend({ 5 tagName: 'th', 6 7 attributeBindings: ['title'], 8 9 // The prop that the table is currently sorted by 10 currentProp: '', 11 12 // The prop this sorter controls 13 prop: '', 14 15 classNames: ['is-selectable'], 16 classNameBindings: ['isActive:is-active', 'sortDescending:desc:asc'], 17 18 isActive: computed('currentProp', 'prop', function() { 19 return this.currentProp === this.prop; 20 }), 21 22 shouldSortDescending: computed('sortDescending', 'isActive', function() { 23 return !this.isActive || !this.sortDescending; 24 }), 25 });