【发布时间】:2015-05-03 13:49:18
【问题描述】:
我有一个 ember 应用程序,其中有一张桌子。我正在尝试做一个简单的列标题排序,但似乎无法让它工作或找到任何关于如何做到这一点的体面示例。任何援助将不胜感激。
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'));
}
}
});
【问题讨论】:
标签: sorting ember.js html-table