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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.