//Call the function when your table renders
$(document).on('knack-view-render.view_XXX', function (event, view , data) {
addGroupRecordCount(view);
})
// Adds the record count to the group text
var addGroupRecordCount = function (view) {
$(’#’ + view.key + " .kn-table-group").each(function () {
var StartRow = this.rowIndex;
var TableRows = $(this).parent().children();
var RowCount = 0;
Josh - it would be possible but with some problems:
The filters load items on the fly, so you'd have to code an Ajax call to count the items that fit the filter criteria on view render, adding significant load time to the page. Then add the number to the filter text (the easier part).
Or, create a view on the same page that contains Count fields for each filter, read those numbers and add them to the filter text. That means adding fields to objects and making sure they calculate the same records as the view filters do all the time.
My code above simply counts the rows between groups without having to read from the underlying database so the overhead is low and the load time hardly changes.