2017-09-12 5 views
0

Ich versuche, eckige Tabelle Reihenfolge nach Datum Spalte (absteigende Reihenfolge). Aber es funktioniert nicht (Datum Spalte Datentyp ist String, in einigen Grund String-Datentyp erhalten). Bitte helfen Sie mir.Winkeltabelle orderBy Spalte

Beispieldaten

Trans.Date | Receipt/Ref No | Trx Code | Description | Receipt Amt | Debit  | Credit | Running Balance 

2013-08-15 | 000000000001  | OST  | OST  | 0.00  | 150.00 | 0.00 | 150.00  
2013-08-15 | 000000000001  | OTH  | Amounts | 0.00  | 8,000.00 | 0.00 | 8,150.00  
2013-09-15 | 000000000001  | RNT  | Rental  | 0.00  | 3,041.00 | 0.00 | 11,191.00  
2013-10-15 | 000000000002  | RNT  | Rental  | 0.00  | 3,041.00 | 0.00 | 14,232.00 

-Code

<table id="tblTrans" class="display table-bordered" cellspacing="0" width="100%" style="font-size: small;"> 
<thead> 
    <tr> 
     <th>Date</th> 
     <th>Receipt/Ref No</th> 
     <th>Trx Code</th> 
     <th>Description</th> 
     <th>Pay Mode</th> 
     <th>Receipt Amt</th> 
     <th>Debit</th> 
     <th>Credit</th> 
     <th>Running Balance</th> 
    </tr> 
</thead> 
<tbody> 
    <tr ng-repeat="objtrn in transactions | orderBy:'TRNDATE' | startFrom:currentPageTrn*pageSize | limitTo:pageSize "> 
     <td>{{objtrn.TRNDATE}}</td> 
     <td>{{objtrn.TRNNO}}</td>        
     <td>{{objtrn.TRNCODE}}</td> 
     <td>{{objtrn.DESCR}}</td> 
     <td>{{objtrn.PAYMODE}}</td> 
     <td style="text-align:right">{{objtrn.TRNAMT | number:2}}</td> 
     <td style="text-align:right">{{objtrn.DEBIT | number:2}}</td> 
     <td style="text-align:right">{{objtrn.CREDIT | number:2}}</td> 
     <td style="text-align:right">{{objtrn.RUNBAL | number:2}}</td> 
    </tr> 
</tbody> 

+0

Warum sagt es nicht funktioniert? Ihre Beispieldaten sehen nach Datum geordnet aus. Und mit diesem Datumsformat können Sie die richtige Reihenfolge erhalten. – Fetrarij

+0

Es tut mir leid, es vorher zu erwähnen, ich möchte absteigend bestellen. – Rika

+0

orderBy: 'TRNDATE': true – akrabi

Antwort

0

Verwenden Sie die Reverse Argument (siehe documentation)

Die Syntax ist: orderBy : expression : reverse : comparator

In Ihrem Fall, ändern Sie Ihre Filter:

orderBy:'TRNDATE':true 
+1

Es ist Arbeit Danke – Rika

0

Try this: orderBy:'-TRNDATE'. Ich habe diesen Weg für id in ehrwürdiger Weise gemacht. Also hoffe, es wird dir helfen.