Skip to content

Instantly share code, notes, and snippets.

@alegut
Created May 7, 2019 12:51
Show Gist options
  • Save alegut/300dffe0ac14cbf9177e45a1fdb5e1cf to your computer and use it in GitHub Desktop.
Save alegut/300dffe0ac14cbf9177e45a1fdb5e1cf to your computer and use it in GitHub Desktop.
Ag-grid case insensitive sorting
{
headerName: this.utilsService.setColumnHeader('first_name', this.headerName),
field: 'name',
resizable: true,
sortable: true,
filter: true,
sortingOrder: ['asc', 'desc'],
width: 160,
comparator: (valueA, valueB, nodeA, nodeB, isInverted) => {
return this.caseInsensitiveSort(valueA, valueB, nodeA, nodeB, isInverted); }
},
caseInsensitiveSort(valueA, valueB, nodeA, nodeB, isInverted) {
return valueA.toLowerCase().localeCompare(valueB.toLowerCase());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment