2016-09-07 202 views
1

像在标题中提到的我想按我的排列顺序对我的表排序,而不是正常方式 - >按字母排序。排序表的顺序不按字母顺序排列

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”中 - 就像Constant Array中那样。所以像这样的
在工作
评论
再在编辑
成品
和反向。
我可以以某种方式添加$索引或类似的工作吗?

回答

0

您是否可以创建一个plunker/fiddle并发布相同的链接以便更好地理解?

+0

你应该把它作为注释 –

+0

http://codepen.io/anon/pen/fjkcg 这不是我的代码,但作为例子。如果您排列名字Colum它按字母排序。我的愿望是,如果我点击排序,它应该像数组中排序。例如,它可能是John-> Frank-> Sue //参见.js中的$ scope.data – AkAk47