mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-06 16:02:39 +02:00
Initial commit
This commit is contained in:
parent
35b2b2d173
commit
b20d3c1726
|
@ -6,12 +6,16 @@ import {
|
||||||
import {isFn} from '../../types';
|
import {isFn} from '../../types';
|
||||||
import {addEvt, targetEvt} from '../../event';
|
import {addEvt, targetEvt} from '../../event';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns Visibility extension
|
||||||
|
*/
|
||||||
export default class ColsVisibility extends Feature {
|
export default class ColsVisibility extends Feature {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Columns Visibility extension
|
* Creates an instance of ColsVisibility
|
||||||
* @param {Object} tf TableFilter instance
|
*
|
||||||
* @param {Object} f Extension's configuration
|
* @param {TableFilter} tf TableFilter instance
|
||||||
|
* @param {Object} Configuration object
|
||||||
*/
|
*/
|
||||||
constructor(tf, f) {
|
constructor(tf, f) {
|
||||||
super(tf, f.name);
|
super(tf, f.name);
|
||||||
|
@ -19,20 +23,46 @@ export default class ColsVisibility extends Feature {
|
||||||
// Configuration object
|
// Configuration object
|
||||||
let cfg = tf.config();
|
let cfg = tf.config();
|
||||||
|
|
||||||
this.initialized = false;
|
/**
|
||||||
|
* Module name
|
||||||
|
* @type {String}
|
||||||
|
*/
|
||||||
this.name = f.name;
|
this.name = f.name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module description
|
||||||
|
* @type {String}
|
||||||
|
*/
|
||||||
this.desc = f.description || 'Columns visibility manager';
|
this.desc = f.description || 'Columns visibility manager';
|
||||||
|
|
||||||
//show/hide cols span element
|
/**
|
||||||
|
* show/hide columns container element
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.spanEl = null;
|
this.spanEl = null;
|
||||||
//show/hide cols button element
|
|
||||||
|
/**
|
||||||
|
* show/hide columns button element
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.btnEl = null;
|
this.btnEl = null;
|
||||||
//show/hide cols container div element
|
|
||||||
|
/**
|
||||||
|
* show/hide columns main container element
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this.contEl = null;
|
this.contEl = null;
|
||||||
|
|
||||||
//tick to hide or show column
|
/**
|
||||||
|
* Enable tick to hide a column, defaults to true
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
this.tickToHide = f.tick_to_hide === false ? false : true;
|
this.tickToHide = f.tick_to_hide === false ? false : true;
|
||||||
//enables/disables cols manager generation
|
|
||||||
|
/**
|
||||||
|
* Enable columns manager UI, defaults to true
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
this.manager = f.manager === false ? false : true;
|
this.manager = f.manager === false ? false : true;
|
||||||
//only if external headers
|
//only if external headers
|
||||||
this.headersTbl = f.headers_table || false;
|
this.headersTbl = f.headers_table || false;
|
||||||
|
|
|
@ -95,11 +95,11 @@ export class ClearButton extends Feature {
|
||||||
targetEl.appendChild(resetspan);
|
targetEl.appendChild(resetspan);
|
||||||
|
|
||||||
if (!this.html) {
|
if (!this.html) {
|
||||||
let fltreset = createElm('a', ['href', 'javascript:void(0);']);
|
let fltReset = createElm('a', ['href', 'javascript:void(0);']);
|
||||||
fltreset.className = this.cssClass;
|
fltReset.className = this.cssClass;
|
||||||
fltreset.appendChild(createText(this.text));
|
fltReset.appendChild(createText(this.text));
|
||||||
resetspan.appendChild(fltreset);
|
resetspan.appendChild(fltReset);
|
||||||
addEvt(fltreset, 'click', () => this.onClick());
|
addEvt(fltReset, 'click', () => this.onClick());
|
||||||
} else {
|
} else {
|
||||||
resetspan.innerHTML = this.html;
|
resetspan.innerHTML = this.html;
|
||||||
let resetEl = resetspan.firstChild;
|
let resetEl = resetspan.firstChild;
|
||||||
|
|
Loading…
Reference in a new issue