mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Show ungrouped group when there are results (#20716)
This commit is contained in:
parent
8fdb7fa1d5
commit
8b220acca2
@ -565,36 +565,30 @@ export class HaDataTable extends LitElement {
|
|||||||
}, {});
|
}, {});
|
||||||
const groupedItems: DataTableRowData[] = [];
|
const groupedItems: DataTableRowData[] = [];
|
||||||
Object.entries(sorted).forEach(([groupName, rows]) => {
|
Object.entries(sorted).forEach(([groupName, rows]) => {
|
||||||
if (
|
groupedItems.push({
|
||||||
groupName !== UNDEFINED_GROUP_KEY ||
|
append: true,
|
||||||
Object.keys(sorted).length > 1
|
content: html`<div
|
||||||
) {
|
class="mdc-data-table__cell group-header"
|
||||||
groupedItems.push({
|
role="cell"
|
||||||
append: true,
|
.group=${groupName}
|
||||||
content: html`<div
|
@click=${this._collapseGroup}
|
||||||
class="mdc-data-table__cell group-header"
|
>
|
||||||
role="cell"
|
<ha-icon-button
|
||||||
.group=${groupName}
|
.path=${mdiChevronUp}
|
||||||
@click=${this._collapseGroup}
|
class=${this._collapsedGroups.includes(groupName)
|
||||||
|
? "collapsed"
|
||||||
|
: ""}
|
||||||
>
|
>
|
||||||
<ha-icon-button
|
</ha-icon-button>
|
||||||
.path=${mdiChevronUp}
|
${groupName === UNDEFINED_GROUP_KEY
|
||||||
class=${this._collapsedGroups.includes(groupName)
|
? this.hass.localize("ui.components.data-table.ungrouped")
|
||||||
? "collapsed"
|
: groupName || ""}
|
||||||
: ""}
|
</div>`,
|
||||||
>
|
});
|
||||||
</ha-icon-button>
|
|
||||||
${groupName === UNDEFINED_GROUP_KEY
|
|
||||||
? this.hass.localize("ui.components.data-table.ungrouped")
|
|
||||||
: groupName || ""}
|
|
||||||
</div>`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!this._collapsedGroups.includes(groupName)) {
|
if (!this._collapsedGroups.includes(groupName)) {
|
||||||
groupedItems.push(...rows);
|
groupedItems.push(...rows);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
items = groupedItems;
|
items = groupedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user