我有,我有一個表中的餘燼應用。我試圖做一個簡單的列標題排序,但似乎無法讓它工作或找到任何體面的例子如何做到這一點。任何援助將不勝感激。簡單燼表頭排序
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(控制器):
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'));
}
}
});
非常感謝NEM。在完成排序後,我沒有重新設置模型。這工作!謝謝! – jdoyle0116 2015-03-03 14:55:15
@ jdoyle0116沒問題,很樂意幫忙。 – nem035 2015-03-03 15:31:00