def html_render_group_footer(self, tbody, group, level=0): """ Render the group footer (=group totals) @param tbody: the TBODY or TABLE to append to @param group: the group dict @param level: the grouping level @todo: add group label to footer if no group headers @todo: add totals label """ data = self.data columns = data.get("c") totals = group.get("t") value = group.get("v") footer_row = TR(_class="gi-group-footer gi-level-%s" % level) if not totals: if not self.group_headers: footer_row.append(TD(value, _colspan = len(columns))) tbody.append(footer_row) return if columns: label = None span = 0 for column in columns: has_value = column in totals if label is None: if not has_value: span += 1 continue else: label = TD("%s %s" % (s3_unicode(s3_strip_markup(value)), self.totals_label, ), _class = "gi-group-footer-label", _colspan = span, ) footer_row.append(label) value = totals[column] if has_value else "" footer_row.append(TD(value)) tbody.append(footer_row)