diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 886a5ad963e5..948bea729ea6 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -565,36 +565,30 @@ export class HaDataTable extends LitElement { }, {}); const groupedItems: DataTableRowData[] = []; Object.entries(sorted).forEach(([groupName, rows]) => { - if ( - groupName !== UNDEFINED_GROUP_KEY || - Object.keys(sorted).length > 1 - ) { - groupedItems.push({ - append: true, - content: html`
+ - - - ${groupName === UNDEFINED_GROUP_KEY - ? this.hass.localize("ui.components.data-table.ungrouped") - : groupName || ""} -
`, - }); - } + + ${groupName === UNDEFINED_GROUP_KEY + ? this.hass.localize("ui.components.data-table.ungrouped") + : groupName || ""} + `, + }); if (!this._collapsedGroups.includes(groupName)) { groupedItems.push(...rows); } }); - items = groupedItems; }