I've been attempting to use Angular.js to sort the table list, but it doesn't seem to be working as expected. Below is my code:
<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>
My goal here is to sort the list based on the total and rest_name fields
. The idea is to sort by total column value in descending order, and if there are duplicates, then sort by rest_name
. However, the current output I'm getting looks like this.
https://i.sstatic.net/eTMMN.jpg
In the image, you can see that an entry with a total column value of 11
is appearing last, when it should actually appear first.