I have an ember application in which I have a table. I'm trying to do a simple column header sort but can't seem to get it to work or find any decent examples on how to do this. Any assistance would be appreciated.
links.hbs:
<thead>
<tr>
<th {{action "sortBy" "linkID"}}>ID</th>
<th {{action "sortBy" "name"}}>NAME</th>
<th {{action "sortBy" "description"}}>DESCRIPTION</th>
<th {{action "sortBy" "url"}}>URL</th>
<th {{action "sortBy" "effDate"}}>EFFECTIVE DATE</th>
<th {{action "sortBy" "endDate"}}>END DATE</th>
<th {{action "sortBy" "secr"}}>SECURITY RESOURCE</th>
<tr>
</thead>
links.js (controller):
import Ember from 'ember';
export default Ember.ArrayController.extend({
actions:{
sortBy: function(property) {
alert('Hello');
this.set('sortProperties', [property]);
this.set('sortAscending', !this.get('sortAscending'));
}
}
});
Aucun commentaire:
Enregistrer un commentaire