From 8b220acca28accb7b5378bb5e13df25ae4a138b0 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 6 May 2024 15:07:22 +0200 Subject: [PATCH] Show ungrouped group when there are results (#20716) --- src/components/data-table/ha-data-table.ts | 44 ++++++++++------------ 1 file changed, 19 insertions(+), 25 deletions(-) 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; }