diff --git a/src/panels/config/zha/zha-add-group-page.ts b/src/panels/config/zha/zha-add-group-page.ts index 733c040297..e5bdd726f0 100644 --- a/src/panels/config/zha/zha-add-group-page.ts +++ b/src/panels/config/zha/zha-add-group-page.ts @@ -6,6 +6,7 @@ import { css, CSSResult, PropertyValues, + query, } from "lit-element"; import "../../../layouts/hass-subpage"; @@ -18,7 +19,7 @@ import { addGroup, ZHAGroup, } from "../../../data/zha"; -import "./zha-devices-data-table"; +import { ZHADevicesDataTable } from "./zha-devices-data-table"; import { SelectionChangedEvent } from "../../../components/data-table/ha-data-table"; import { navigate } from "../../../common/navigate"; import { PolymerChangedEvent } from "../../../polymer-types"; @@ -34,6 +35,8 @@ export class ZHAAddGroupPage extends LitElement { @property() public devices: ZHADevice[] = []; @property() private _processingAdd: boolean = false; @property() private _groupName: string = ""; + @query("zha-devices-data-table") + private _zhaDevicesDataTable!: ZHADevicesDataTable; private _firstUpdatedCalled: boolean = false; private _selectedDevicesToAdd: string[] = []; @@ -130,6 +133,7 @@ export class ZHAAddGroupPage extends LitElement { this._selectedDevicesToAdd = []; this._processingAdd = false; this._groupName = ""; + this._zhaDevicesDataTable.clearSelection(); navigate(this, `/config/zha/group/${group.group_id}`, true); } diff --git a/src/panels/config/zha/zha-clusters-data-table.ts b/src/panels/config/zha/zha-clusters-data-table.ts index 817fc71310..9216b832e5 100644 --- a/src/panels/config/zha/zha-clusters-data-table.ts +++ b/src/panels/config/zha/zha-clusters-data-table.ts @@ -9,10 +9,14 @@ import { TemplateResult, property, customElement, + query, } from "lit-element"; import { HomeAssistant } from "../../../types"; // tslint:disable-next-line -import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table"; +import { + DataTableColumnContainer, + HaDataTable, +} from "../../../components/data-table/ha-data-table"; // tslint:disable-next-line import { Cluster } from "../../../data/zha"; import { formatAsPaddedHex } from "./functions"; @@ -27,6 +31,7 @@ export class ZHAClustersDataTable extends LitElement { @property() public hass!: HomeAssistant; @property() public narrow = false; @property() public clusters: Cluster[] = []; + @query("ha-data-table") private _dataTable!: HaDataTable; private _clusters = memoizeOne((clusters: Cluster[]) => { let outputClusters: ClusterRowData[] = clusters; @@ -77,6 +82,10 @@ export class ZHAClustersDataTable extends LitElement { } ); + public clearSelection() { + this._dataTable.clearSelection(); + } + protected render(): TemplateResult { return html` { let outputDevices: DeviceRowData[] = devices; @@ -89,6 +94,10 @@ export class ZHADevicesDataTable extends LitElement { } ); + public clearSelection() { + this._dataTable.clearSelection(); + } + protected render(): TemplateResult { return html` { let outputGroups: GroupRowData[] = groups; @@ -98,6 +103,10 @@ export class ZHAGroupsDataTable extends LitElement { } ); + public clearSelection() { + this._dataTable.clearSelection(); + } + protected render(): TemplateResult { return html`