2016-09-07 4 views
1

wie im Titel erwähnt Ich möchte meine Tabelle nach der Reihenfolge meiner Array und nicht den normalen Weg sortieren -> alphabetisch.Sortiert Tabelle nach der Reihenfolge der Array nicht alphabetisch

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> 

So ist es
wieder in Bearbeiten
Fertige
In Arbeit
Bewertung
Und gleiche in umge Sortierung. Aber es soll in der "Todo Chain" -> wie im Constant Array sein. So wie diese
In Arbeit
Bewertung
wieder in Bearbeiten
Fertige
und Reverse.
Kann ich irgendwie $ index oder etwas hinzufügen, so dass es so funktioniert?

Antwort

0

Können Sie ein plunker/fiddle erstellen und den Link für das gleiche zum besseren Verständnis veröffentlichen?

+0

sollten Sie es als Kommentar setzen –

+0

http://codepen.io/anon/pen/fjkcg Das ist nicht mein Code aber als Beispiel. Wenn Sie den Vornamen Colum sortieren, wird alphabetisch sortiert. Mein Wunsch ist, dass wenn ich auf Sortieren klicke, sollte es wie im Array sortiert werden. Für das Beispiel wäre es John-> Frank-> Sue // siehe $ scope.data in .js – AkAk47

Verwandte Themen