Is there a function I can set to a column that when the grid is grouped by that column it will know to sort the getter in a certain order, either ascending or descending for now.
There is a comparer
property of the grouping settings object.
Here's a snippet from example-grouping.html:
function groupByDurationOrderByCount(aggregateCollapsed) {
dataView.setGrouping({
getter: "duration",
formatter: function (g) {
return "Duration: " + g.value + " <span style='color:green'>(" + g.count + " items)</span>";
},
comparer: function (a, b) {
return a.count - b.count;
},
aggregators: [
new Slick.Data.Aggregators.Avg("percentComplete"),
new Slick.Data.Aggregators.Sum("cost")
],
aggregateCollapsed: aggregateCollapsed,
lazyTotalsCalculation: true
});
}
The comparer is passed to the javascript sort
method. See here for more info about how to construct the comparer function.