I’m trying to sort my date if the user clicks in a , but is not working well. That’s the code:
Inside my table header i have:
<th class="tables__th" {{action "sortBy" "name"}}>Nome</th>
<th class="tables__th" {{action "sortBy" "date"}}>Data</th>
<th class="tables__th" {{action "sortBy" "bookings"}}>Reservas</th>
And in the controller i have:
export default Ember.Controller.extend(PcCheckbox, PcRequest, {
requestName: 'Evento',
query: '',
/*
*
* Default sort properties
*/
sortAscending: true,
sortProperty: 'date',
actions: {
sortBy(propertyKey) {
if (propertyKey === this.get('sortProperty')) {
this.toggleProperty('sortAscending');
}
this.set('sortProperty', propertyKey);
}
}
});
Shouldn’t this by enough??
Thanks.