Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion great_tables/_utils_render_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from . import _locations as loc
from ._gt_data import GroupRowInfo, GTData, Styles
from ._spanners import spanners_print_matrix
from ._tbl_data import _get_cell, cast_frame_to_string, replace_null_frame
from ._tbl_data import _get_cell, cast_frame_to_string, is_na, replace_null_frame
from ._text import BaseText, _process_text, _process_text_id
from ._utils import heading_has_subtitle, heading_has_title, seq_groups

Expand Down Expand Up @@ -479,6 +479,14 @@ def create_body_component_h(data: GTData) -> str:
# Only create if this is the first row of data within the group
if group_info is not prev_group_info:
group_label = group_info.defaulted_label()

# If we have a group_label, fetch group label from _tbl_data
# since fmt functions have been applied at this point
if not is_na(tbl_data, group_label):
rowgroup_var = data._boxhead._get_row_group_column()
cell_content: Any = _get_cell(tbl_data, i, rowgroup_var.var)
group_label: str = str(cell_content)

group_class = (
"gt_empty_group_heading" if group_label == "" else "gt_group_heading_row"
)
Expand Down
Loading