feat(hide-columns): get table wrapper ident for storage ident

This commit is contained in:
Sarah Vaupel 2019-11-26 17:00:38 +01:00 committed by Gregor Kleen
parent 5cc88089b5
commit d55d3ef484
2 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,7 @@ export class HideColumns {
_storageManager = new StorageManager('uw-hide-columns');
_element;
_elementWrapper;
_tableUtilContainer;
constructor(element) {
@ -38,6 +39,7 @@ export class HideColumns {
if (!hideColumnsContainer) {
throw new Error('Hide Columns utility needs to be setup on a table inside a hide columns container!');
}
this._elementWrapper = hideColumnsContainer;
// get or create table utils container
this._tableUtilContainer = hideColumnsContainer.querySelector(TABLE_UTILS_CONTAINER_SELECTOR);
@ -123,7 +125,7 @@ export class HideColumns {
const handlerIdent = document.querySelector('[uw-handler]').getAttribute('uw-handler');
// get hide-columns container ident (if not present, use table index in document as fallback)
let tIdent = th.getAttribute(TABLE_HEADER_IDENT);
let tIdent = this._elementWrapper.getAttribute(HIDE_COLUMNS_CONTAINER_IDENT);
if (!tIdent) {
const tablesInDocument = document.getElementsByTagName('TABLE');
for (let i = 0; i < tablesInDocument.length; i++) {

View File

@ -1,3 +1,3 @@
$newline never
<div ##{wIdent "table-wrapper"} :not (null rows && (dbsEmptyStyle == DBESNoHeading)):uw-async-table uw-hide-columns data-async-table-db-header=#{toPathPiece HeaderDBTableShortcircuit}>
<div ##{wIdent "table-wrapper"} :not (null rows && (dbsEmptyStyle == DBESNoHeading)):uw-async-table uw-hide-columns=#{dbtIdent} data-async-table-db-header=#{toPathPiece HeaderDBTableShortcircuit}>
^{table}