feat(hide-columns): get table wrapper ident for storage ident
This commit is contained in:
parent
5cc88089b5
commit
d55d3ef484
@ -20,6 +20,7 @@ export class HideColumns {
|
|||||||
_storageManager = new StorageManager('uw-hide-columns');
|
_storageManager = new StorageManager('uw-hide-columns');
|
||||||
|
|
||||||
_element;
|
_element;
|
||||||
|
_elementWrapper;
|
||||||
_tableUtilContainer;
|
_tableUtilContainer;
|
||||||
|
|
||||||
constructor(element) {
|
constructor(element) {
|
||||||
@ -38,6 +39,7 @@ export class HideColumns {
|
|||||||
if (!hideColumnsContainer) {
|
if (!hideColumnsContainer) {
|
||||||
throw new Error('Hide Columns utility needs to be setup on a table inside a hide columns container!');
|
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
|
// get or create table utils container
|
||||||
this._tableUtilContainer = hideColumnsContainer.querySelector(TABLE_UTILS_CONTAINER_SELECTOR);
|
this._tableUtilContainer = hideColumnsContainer.querySelector(TABLE_UTILS_CONTAINER_SELECTOR);
|
||||||
@ -123,7 +125,7 @@ export class HideColumns {
|
|||||||
const handlerIdent = document.querySelector('[uw-handler]').getAttribute('uw-handler');
|
const handlerIdent = document.querySelector('[uw-handler]').getAttribute('uw-handler');
|
||||||
|
|
||||||
// get hide-columns container ident (if not present, use table index in document as fallback)
|
// 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) {
|
if (!tIdent) {
|
||||||
const tablesInDocument = document.getElementsByTagName('TABLE');
|
const tablesInDocument = document.getElementsByTagName('TABLE');
|
||||||
for (let i = 0; i < tablesInDocument.length; i++) {
|
for (let i = 0; i < tablesInDocument.length; i++) {
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
$newline never
|
$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}
|
^{table}
|
||||||
|
|||||||
Reference in New Issue
Block a user