1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-18 08:29:50 +01:00

Made popup filters element anchored to container

This commit is contained in:
Max Guglielmi 2017-04-26 07:29:08 +10:00
commit 29960cada8
15 changed files with 50 additions and 33 deletions

View file

@ -55,6 +55,13 @@ export class PopupFilter extends Feature {
this.iconHtml = f.popup_filters_image_html ||
'<img src="' + this.iconPath + '" alt="Column filter" />';
/**
* Css class assigned to the popup container element
* @type {String}
*/
this.placeholderCssClass =
f.popup_placeholder_css_class || 'popUpPlaceholder';
/**
* Css class assigned to filter container element
* @type {String}
@ -277,12 +284,14 @@ export class PopupFilter extends Feature {
build(colIndex, div) {
let tf = this.tf;
let contId = `${this.prfxDiv}${tf.id}_${colIndex}`;
let cont = div || createElm('div', ['id', contId]);
cont.className = this.containerCssClass;
let placeholder = createElm('div', ['class', this.placeholderCssClass]);
let cont = div ||
createElm('div', ['id', contId], ['class', this.containerCssClass]);
tf.externalFltTgtIds.push(cont.id);
placeholder.appendChild(cont);
let header = tf.getHeaderElement(colIndex);
header.insertBefore(cont, header.firstChild);
header.insertBefore(placeholder, header.firstChild);
addEvt(cont, 'click', (evt) => stopEvt(evt));
this.fltElms[colIndex] = cont;
}
@ -408,6 +417,7 @@ export class PopupFilter extends Feature {
this.filtersCache = [];
for (let i = 0; i < this.fltElms.length; i++) {
let container = this.fltElms[i],
placeholder = container.parentNode,
icon = this.fltSpans[i],
iconImg = this.fltIcons[i];
if (container) {
@ -415,6 +425,10 @@ export class PopupFilter extends Feature {
this.filtersCache[i] = container;
}
container = null;
if (placeholder) {
removeElm(placeholder);
}
placeholder = null;
if (icon) {
removeElm(icon);
}