Sortable table component
This commit is contained in:
parent
e623d52f34
commit
6ba5cf2322
23 changed files with 225 additions and 74 deletions
13
app/pods/components/sortable-table/component.js
Normal file
13
app/pods/components/sortable-table/component.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend(Ember.SortableMixin, {
|
||||
tagName: 'table',
|
||||
classNames: ['flakes-table'],
|
||||
|
||||
actions: {
|
||||
sortBy: function(property, ascending) {
|
||||
this.set('sortAscending', ascending);
|
||||
this.set('sortProperties', [property]);
|
||||
}
|
||||
},
|
||||
});
|
13
app/pods/components/sortable-table/template.hbs
Normal file
13
app/pods/components/sortable-table/template.hbs
Normal file
|
@ -0,0 +1,13 @@
|
|||
<thead>
|
||||
<tr>
|
||||
{{#each a in tableAttrs}}
|
||||
{{sortable-table-header title=a.name sortProperty=a.attr action="sortBy"}}
|
||||
{{/each}}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{#each item in arrangedContent}}
|
||||
{{component row data=item}}
|
||||
{{/each}}
|
||||
</tbody>
|
Reference in a new issue