I am using Angular datatables to populate my table based on a webservice response. My webservice returns me a json like below
[
{
"id": 1,
"name" : "abc",
"count": "(20)"
},
{
"id": 2,
"name" : "abc2",
"count": "20"
},
{
"id": 3,
"name" : "abc3",
"count": "(30)"
}
]
I am able to bind the JSON array to my $scope variable in the table below
<table datatable="ng" dt-options="dtOptions" dt-column-defs="dtColumnDefs">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>count</th>
</tr>
</thead>
<tbody ng-repeat= "item in items">
<td> {{item.id}} </td>
<td> {{item.name}} </td>
<td> {{item.count}} </td>
</tbody>
</table>
The id and name columns are sorted properly in ascending and descending order but the count column is not sorted based on the numbers. Instead it takes the "(" into account while sorting and the sorting. I want the sort result for the count column to be
In ascending
20
(20)
(30)
Right now i get in ascending order
(20)
(30)
20
Can anyone suggest what is the logic i need to apply?