I am trying to show a table with scheduled employee reviews by month with the most recent month at the top. Is there anyway to force the group to sort by date not alphebetically?
One simple way to do this is to create a text field which holds the numeric and then text versions of the month ( 01-January ) - the formula would be something like:
formatDate({Date 1},MM-MMMM)
And the table would look like this:
It would be better if we could have intelligent grouping of tables etc when you select a date field to group by (as you get in reports).
Here’s a workaround I’ve found. On the table in question, group the table by the original date field and then by the formatted data field (i.e. the month field). Like so
This allows us to sort by the date. We’re now going to add Javascript to remove the duplicate grouping. On your live app, right-click on the table and click inspect and find the view number of the table. It’ll be of the form “view_xx”.
Add the following code to the Javascript terminal (replacing “xx” with the number found for your table"):
$(document).on(‘knack-view-render.view_xx’, function(event, view, data) {
$(".kn-group-level-1").remove();
});
The formatting of the grouping rows are a bit weird. So I’ve also added the following to the CSS so that the text sits in the middle of the row (don’t forget to replace the “xx”):
.view_xx .kn-group-level-2 td {
padding-top: 10px !important;
}
Hope that helps!