mariuszfoltak / angular2-datatable

DataTable - Simple table component with sorting and pagination for Angular2
202 stars 182 forks source link

Sort not working with numbers #138

Open annbabu opened 7 years ago

annbabu commented 7 years ago

I have a table which shows organization information like name, users count. Name sorting is possible, but users count sorting is not possible. How can I fix this issue?

kilofafeure commented 6 years ago

Maybe you should use a custom sort function. For example the strings are not sorted as I did expect, and I made my own:

<th class="sortable"> <MfDefaultSorterStyle [by]="sortByTitle">{{ 'LABELS.OperationTitle' | translate}}</MfDefaultSorterStyle> </th>

private sortByTitle = (a: Operation) => { var strWithAccent = a.Title; var strWithoutAccent: string = _.deburr(strWithAccent).toLowerCase(); return strWithoutAccent; }