I want to group my rows by year. I don't have a column with a int Year but I got a column of type Date.
In my column def I added the rowGroup:true to activate grouping.
Now how do I tell aggrid that i want grouping on the year property of my date ?
Is it based on the valueFormatter ?
function (data) {
if (data.value == undefined) return "";
var val = (new Date(data.value)).getFullYear();
return val;
}
Is it based on the comparator func ?
comparator: function (date1, date2) {
if (date1 == undefined) return -1;
if (date2 == undefined) return 1;
var year1 = date1.getFullYear();
var year2 = date2.getFullYear();
if (year1 == year2) return 0;
return (year1 < year2) ?-1:1;
}
I had a breakpoint in comparator. it looks like it's never get called.
Is it in the cellFormatter ? The cellRenderer ?
Right now I got the group behaviour (checkbox to un/fold group of rows). But I got n groups called "2018", one for each date.
Bonus question : how can I display this column as a group and not shows as a normal column ? I want to group by year-only and display a "second" column with the full date dd/mm/yyyy.