I am using ag-grid for generating some tables. So far it has been great. But I am experiencing some difficulty in sorting because my table has some data which are in lowercase and I want my sorting function to ignore the case and sort them just has case sensitive.
The two features that can do this job are cellRenderer and sort function.
cellRenderer function:
cellRenderer: function(params) {
if (params.value=='Police') {
return 'POLICE';
} else {
return params.value.toUpperCase();
}
}
sorting function:
$scope.sortByAthleteAsc = function() {
var sort = [
{field: 'athlete', sort: 'asc'}
];
$scope.gridOptions.api.setSortModel(sort);
};
These are the two examples provided. How can I connect these two functions to produce my table case insensitive sorting?
put a comparator onto the colDef. like the following:
you also are provided the row nodes, where you can access the full row data, not just the value specific to the col.