Show ungrouped group when there are results (#20716)

This commit is contained in:
Simon Lamon 2024-05-06 15:07:22 +02:00 committed by Bram Kragten
parent e5ff6bd2f5
commit 57d1405115

View File

@ -565,10 +565,6 @@ export class HaDataTable extends LitElement {
}, {}); }, {});
const groupedItems: DataTableRowData[] = []; const groupedItems: DataTableRowData[] = [];
Object.entries(sorted).forEach(([groupName, rows]) => { Object.entries(sorted).forEach(([groupName, rows]) => {
if (
groupName !== UNDEFINED_GROUP_KEY ||
Object.keys(sorted).length > 1
) {
groupedItems.push({ groupedItems.push({
append: true, append: true,
content: html`<div content: html`<div
@ -589,12 +585,10 @@ export class HaDataTable extends LitElement {
: groupName || ""} : groupName || ""}
</div>`, </div>`,
}); });
}
if (!this._collapsedGroups.includes(groupName)) { if (!this._collapsedGroups.includes(groupName)) {
groupedItems.push(...rows); groupedItems.push(...rows);
} }
}); });
items = groupedItems; items = groupedItems;
} }