I am working in some grids and I notice that the sorting on all of them is key sensitive is there any way to change that. This is a part of my code.
columnDefs = [
{
headerName: 'Id', field: 'id', sort: 'asc', sortable: true, filter: true,
checkboxSelection: true, resizable: true,
},
{
headerName: 'Name', field: 'name', sortable: true, filter: true,
checkboxSelection: false, editable: true, resizable: true,
},
{
headerName: 'Description', field: 'description', sortable: true, filter: true,
checkboxSelection: false, editable: true, resizable: true,
},
];
Thank you for any possible given help.
This is how i have implement the solution by ##wentjun##:
constructor(private dialog: MatDialog, private adminService: AdminService) {}
columnDefs = [
{
headerName: 'Id', field: 'id', sortable: true, filter: true,
checkboxSelection: true, resizable: true,
},
{
headerName: 'Name', field: 'name', sortable: true, filter: true,
checkboxSelection: false, editable: true, resizable: true,
comparator: this.customComparator,
},
{
headerName: 'Description', field: 'description', sortable: true, filter: true,
checkboxSelection: false, editable: true, resizable: true,
},
];
customComparator(valueA, valueB) {
return valueA.toLowerCase().localeCompare(valueB.toLowerCase());
}
See Question&Answers more detail:
os