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

그래서 편집
에 다시
정렬되어 완료 검토
그리고 역에서 같은 일
에서
. 하지만 Constant Array와 같이 "Todo Chain"에 있어야합니다. 그래서 편집
에서
다시 작업
검토에서이
같은 는
을 완료 및 역방향.
어떻게 든 $ index 같은 것을 추가 할 수 있습니까?

답변

0

더 나은 이해를 위해 plunker/fiddle을 작성하고 동일한 링크를 게시 할 수 있습니까?

+0

당신이 코멘트로 넣어야합니다 –

+0

http://codepen.io/anon/pen/fjkcg 그건 내 코드가 아니라 예제입니다. First name Colum을 정렬하면 해당 알파벳순으로 정렬됩니다. 내 소원은 정렬을 클릭하면 배열에 정렬해야합니다. 예를 들어, John-> Frank-> Sue // .js의 $ scope.data에서 볼 수 있습니다. – AkAk47

관련 문제