I'm using rows group in ag-grid,
Is it possible to sort the group column by the row count?
As follow:
CodePudding user response:
You need to define custom sorting:
const gridOptions = {
columnDefs: [
{
field: 'age',
// simple number comparator
comparator: (valueA, valueB, nodeA, nodeB, isInverted) => valueA - valueB
},
{
field: 'name',
// simple string comparator
comparator: (valueA, valueB, nodeA, nodeB, isInverted) => {
if (valueA == valueB) return 0;
return (valueA > valueB) ? 1 : -1;
}
}
],
// other grid options ...
}
https://www.ag-grid.com/javascript-data-grid/row-sorting/#custom-sorting