2016-06-01 33 views
0

我有一個問題。我試圖使用Angular.js對錶列表進行排序,但它不像那樣發生。我在下面解釋我的代碼。無法按照要求使用Angular.js正確排序表列表

<tbody id="detailsstockid"> 
<tr ng-repeat="c in clickSummary | orderBy:['-total','+rest_name']"> 
    <td>{{$index+1}}</td> 
    <td>{{c.rest_name}}</td> 
    <td>{{c.page_hit}}</td> 
    <td>{{c.map_hit}}</td> 
    <td>{{c.gallery_hit}}</td> 
    <td>{{c.phone_hit}}</td> 
    <td>{{c.web_hit}}</td> 
    <td>{{c.total}}</td> 
</tr> 
</tbody> 

在這裏,我需要對列表進行排序按total and rest_name filed。我需要在降序排序按總列值,如果總共有列相同的值,那麼就應該在排序按rest_name。但我我得到如下的輸出。

enter image description here

在這張圖片中,你可以看到一個具有總列值11但最後這應該是來fast.Please幫我來了。

+0

到這裏看看:http://stackoverflow.com/questions/16764177/angular-orderby-number-sorting-as-text-in-ng-repeat –

回答

0

它按字符串比較而不是數字比較進行排序。這意味着你不會將數據顯示爲數字。

參見文檔here

+0

能否請您正確這個? – satya