2016-01-06 83 views
0

如何在打印表時實現ORDER BY在升序或降序mainSubjectAllocationList & optionSubjectAllocationList KEY。angularJS排序按鍵列表

我的代碼如下

vm.sectionListWithClass = [ 

    { 
    "classStd": "Prep-2015", 
    "classId": "1", 
    "section": "B", 
    "sectionName": "RED", 
    "sectionId": "6", 
    "mainSubjectAllocationList": "Hindi, Biology, Geography, English, Chemistry", 
    "mainSubjectAllocationId": "28", 
    "optionSubjectAllocationList": "Chemistry, P.T, 3rd lang Urdu, Art, 3rd lang Arabic, 3rd lang Chinese, 3rd lang German, Life Skill", 
    "optionSubjectAllocationId": "27" 
    } 
] 





<tbody ng-repeat="(key, value) in vm.sectionListWithClass | groupBy: 'classStd'" > 
        <tr ng-repeat="player in value | orderBy: 'section' | orderBy:'mainSubjectAllocationList':true"> 
+0

什麼上面的代碼的結果呢? – Eria

+0

其在部分上的順序只在部分和mainSubjectAllocationList上都沒有。備用我更改我的SQL查詢 – fresher

回答

0

試試這個(沒有測試過,但我很有信心):

<tr ng-repeat="player in value | orderBy: ['section', '-mainSubjectAllocationList']">