diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts
index 61bff9c04fd8..b4d4ddc58f26 100644
--- a/src/layouts/hass-tabs-subpage-data-table.ts
+++ b/src/layouts/hass-tabs-subpage-data-table.ts
@@ -1,6 +1,9 @@
import { ResizeController } from "@lit-labs/observers/resize-controller";
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
import "@material/mwc-button/mwc-button";
+import "@material/web/menu/menu";
+import type { MdMenu } from "@material/web/menu/menu";
+import "@material/web/menu/menu-item";
import {
mdiArrowDown,
mdiArrowUp,
@@ -19,6 +22,7 @@ import {
nothing,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
+import { classMap } from "lit/directives/class-map";
import { fireEvent } from "../common/dom/fire_event";
import { LocalizeFunc } from "../common/translations/localize";
import "../components/chips/ha-assist-chip";
@@ -173,6 +177,10 @@ export class HaTabsSubpageDataTable extends LitElement {
@query("ha-data-table", true) private _dataTable!: HaDataTable;
+ @query("#group-by-menu") private _groupByMenu!: MdMenu;
+
+ @query("#sort-by-menu") private _sortByMenu!: MdMenu;
+
private _showPaneController = new ResizeController(this, {
callback: (entries) => entries[0]?.contentRect.width > 750,
});
@@ -187,6 +195,14 @@ export class HaTabsSubpageDataTable extends LitElement {
}
}
+ private _toggleGroupBy() {
+ this._groupByMenu.open = !this._groupByMenu.open;
+ }
+
+ private _toggleSortBy() {
+ this._sortByMenu.open = !this._sortByMenu.open;
+ }
+
protected render(): TemplateResult {
const localize = this.localizeFunc || this.hass.localize;
const showPane = this._showPaneController.value ?? !this.narrow;
@@ -226,73 +242,35 @@ export class HaTabsSubpageDataTable extends LitElement {
`;
const sortByMenu = Object.values(this.columns).find((col) => col.sortable)
- ? html`