2016-09-07 249 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