I have a simple problem. When I try to order the ID, it's ordering like
1,12,13,2,20
So I think it assumes this as a string.
I tried to use number but with no help.
What can I do?
thead
<th class="text-center">
Ticket ID
<a uib-tooltip="Sort by" ng-click="vm.sortBy('TICKET_ID');">
<i class="glyphicon glyphicon-sort pull-right"></i>
</a>
</th>
body
<tr class="text-center" ng-repeat="ticket in filteredTickets = (vm.tickets |
orderBy : vm.propertyName : vm.reverse |
filter : vm.search |
limitTo : vm.itemsPerPage : vm.itemsPerPage * (vm.currentPage-1))">
<td>{{ticket.TICKET_ID | number}</td>
<!-- 'number' doesn't help... -->
controller
// table ordering
vm.propertyName = 'TICKET_ID';
vm.reverse = false;
vm.sortBy = function(propertyName) {
vm.reverse = !vm.reverse;
vm.propertyName = propertyName;
};
a.prop1 - b.prop1inside your sortBy function.vm.ticketsin your controller, or write a custom filter that will work asorderBy