In ng2-smart-table of angular 2 sorting functionality is case sensitive. Are there any options to make sorting table data as case insensitive?
Just wanted to throw out if you implement this to make sure you add a : after compareFunction. As shown below...
columns: {
group_name: {
title: 'Groupname',
compareFunction:(direction: any, a: any, b: any) => {
// Converting strings to lowercase
let first = typeof a === 'string' ? a.toLowerCase() : a;
let second = typeof b === 'string' ? b.toLowerCase() : b;
if (first < second) {
return -1 * direction;
}
if (first > second) {
return direction;
}
return 0;
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With