【发布时间】:2016-09-07 14:38:50
【问题描述】:
就像在提到的标题中一样,我想按数组的顺序而不是正常的方式对表格进行排序 -> 按字母顺序。
This is the Array with the Constants.
.constant("appConfig", {
"status": [
"In Work",
"Review",
"Again in Edit",
"Finished"
]
})
//in the html then the standard code for sorting atm Alphabetical
<th>
<a href="#" ng-click="sortType='Status.status';sortReverse = !sortReverse">
Status
<span ng-show="sortType == 'Status.status' && !sortReverse" class="fa fa-caret-down"></span>
<span ng-show="sortType == 'Status.status' && sortReverse" class="fa fa-caret-up"></span>
</a>
<select class="form-control" ng-model="select.Status.status">
<option value="">-- Select --</option>
<option ng-repeat='status in $ctrl.aStatus' >{{status}}</option>
</select>
</th>
<tr dir-paginate="t in $ctrl.getTasks() | filter:{name:k}| orderBy: sortType:sortReverse| filter:select|itemsPerPage: 10 as results">
<td class="td-selects">
<span uib-tooltip="{{t.notice}}" tooltip-popup-delay='500'>
{{t.Status.status}}</span>
</td>
所以它正在排序
再次在编辑中
完成
工作中
评论
和反向相同。但它应该在“Todo Chain”-> 就像在常量数组中一样。像这样
工作中
评论
再次在编辑中
完成
和反向。
我可以以某种方式将 $index 或其他东西添加到它的工作方式中吗?
【问题讨论】:
标签: angularjs arrays sorting constants angularjs-orderby