angularjs - angular table orderBy colunm -


i try angular table order date column(descending order).but doesn't work(date column data type string,in reason have string data type).please me.

sample data

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> 

use reverse argument (see documentation)

the syntax is: orderby : expression : reverse : comparator

in case, change filter to:

orderby:'trndate':true 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -