mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-18 00:19:50 +01:00
Added dom method, made tbl property private
This commit is contained in:
parent
b9ab9582a8
commit
76a61d5a01
45 changed files with 171 additions and 148 deletions
|
|
@ -94,7 +94,7 @@ export class AlternateRows extends Feature {
|
|||
if (!this.isEnabled() || isNaN(rowIdx)) {
|
||||
return;
|
||||
}
|
||||
let rows = this.tf.tbl.rows;
|
||||
let rows = this.tf.dom().rows;
|
||||
let i = isNaN(idx) ? rowIdx : idx;
|
||||
this.removeRowBg(rowIdx);
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ export class AlternateRows extends Feature {
|
|||
if (isNaN(idx)) {
|
||||
return;
|
||||
}
|
||||
let rows = this.tf.tbl.rows;
|
||||
let rows = this.tf.dom().rows;
|
||||
removeClass(rows[idx], this.oddCss);
|
||||
removeClass(rows[idx], this.evenCss);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ export class CheckList extends Feature {
|
|||
['colIndex', colIndex]);
|
||||
ul.className = this.filterCssClass;
|
||||
|
||||
let rows = tf.tbl.rows;
|
||||
let rows = tf.dom().rows;
|
||||
let nbRows = tf.getRowsNb(true);
|
||||
let caseSensitive = tf.caseSensitive;
|
||||
this.isCustom = tf.isCustomOptions(colIndex);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export class Dropdown extends Feature {
|
|||
|
||||
let slcId = tf.fltIds[colIndex];
|
||||
let slc = elm(slcId);
|
||||
let rows = tf.tbl.rows;
|
||||
let rows = tf.dom().rows;
|
||||
let nbRows = tf.getRowsNb(true);
|
||||
|
||||
//custom select test
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ export class GridLayout extends Feature {
|
|||
* @type {String}
|
||||
* @private
|
||||
*/
|
||||
this.sourceTblHtml = tf.tbl.outerHTML;
|
||||
this.sourceTblHtml = tf.dom().outerHTML;
|
||||
|
||||
/**
|
||||
* Indicates if working table has column elements
|
||||
* @type {Boolean}
|
||||
* @private
|
||||
*/
|
||||
this.tblHasColTag = tag(tf.tbl, 'col').length > 0 ? true : false;
|
||||
this.tblHasColTag = tag(tf.dom(), 'col').length > 0 ? true : false;
|
||||
|
||||
/**
|
||||
* Main container element
|
||||
|
|
@ -155,7 +155,7 @@ export class GridLayout extends Feature {
|
|||
*/
|
||||
init() {
|
||||
let tf = this.tf;
|
||||
let tbl = tf.tbl;
|
||||
let tbl = tf.dom();
|
||||
|
||||
if (this.initialized) {
|
||||
return;
|
||||
|
|
@ -319,7 +319,7 @@ export class GridLayout extends Feature {
|
|||
}
|
||||
for (let k = 0, len = tf.getCellsNb(); k < len; k++) {
|
||||
let colW;
|
||||
let cell = tf.tbl.rows[tf.getHeadersRowIndex()].cells[k];
|
||||
let cell = tf.dom().rows[tf.getHeadersRowIndex()].cells[k];
|
||||
if (cell.width !== '') {
|
||||
colW = cell.width;
|
||||
} else if (cell.style.width !== '') {
|
||||
|
|
@ -339,7 +339,7 @@ export class GridLayout extends Feature {
|
|||
* @private
|
||||
*/
|
||||
initialTableWidth() {
|
||||
let tbl = this.tf.tbl;
|
||||
let tbl = this.tf.dom();
|
||||
let width; //initial table width
|
||||
|
||||
if (tbl.width !== '') {
|
||||
|
|
@ -392,7 +392,7 @@ export class GridLayout extends Feature {
|
|||
*/
|
||||
setColumnElements() {
|
||||
let tf = this.tf;
|
||||
let cols = tag(tf.tbl, 'col');
|
||||
let cols = tag(tf.dom(), 'col');
|
||||
this.tblHasColTag = cols.length > 0;
|
||||
|
||||
for (let k = (tf.nbCells - 1); k >= 0; k--) {
|
||||
|
|
@ -400,7 +400,7 @@ export class GridLayout extends Feature {
|
|||
|
||||
if (!this.tblHasColTag) {
|
||||
col = createElm('col');
|
||||
tf.tbl.insertBefore(col, tf.tbl.firstChild);
|
||||
tf.dom().insertBefore(col, tf.dom().firstChild);
|
||||
} else {
|
||||
col = cols[k];
|
||||
}
|
||||
|
|
@ -423,7 +423,7 @@ export class GridLayout extends Feature {
|
|||
} else {
|
||||
// Headers row are moved from content table to headers table
|
||||
for (let i = 0; i < this.headRows.length; i++) {
|
||||
let row = this.tf.tbl.rows[this.headRows[i]];
|
||||
let row = this.tf.dom().rows[this.headRows[i]];
|
||||
tableHead.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
|
@ -471,7 +471,7 @@ export class GridLayout extends Feature {
|
|||
*/
|
||||
destroy() {
|
||||
let tf = this.tf;
|
||||
let tbl = tf.tbl;
|
||||
let tbl = tf.dom();
|
||||
|
||||
if (!this.initialized) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export class HighlightKeyword {
|
|||
* @param {String} cssClass Css class to remove
|
||||
*/
|
||||
unhighlight(term, cssClass) {
|
||||
let highlightedNodes = this.tf.tbl.querySelectorAll(`.${cssClass}`);
|
||||
let highlightedNodes = this.tf.dom().querySelectorAll(`.${cssClass}`);
|
||||
for (let i = 0; i < highlightedNodes.length; i++) {
|
||||
let n = highlightedNodes[i];
|
||||
let nodeVal = getText(n);
|
||||
|
|
|
|||
|
|
@ -100,9 +100,9 @@ export class Loader extends Feature {
|
|||
containerDiv.className = this.cssClass;
|
||||
|
||||
let targetEl = !this.targetId ?
|
||||
tf.tbl.parentNode : elm(this.targetId);
|
||||
tf.dom().parentNode : elm(this.targetId);
|
||||
if (!this.targetId) {
|
||||
targetEl.insertBefore(containerDiv, tf.tbl);
|
||||
targetEl.insertBefore(containerDiv, tf.dom());
|
||||
} else {
|
||||
targetEl.appendChild(containerDiv);
|
||||
}
|
||||
|
|
@ -119,9 +119,7 @@ export class Loader extends Feature {
|
|||
emitter.on(EVENTS, () => this.show(''));
|
||||
emitter.on(EVENTS, () => this.show(NONE));
|
||||
|
||||
/**
|
||||
* @inherited
|
||||
*/
|
||||
/** @inherited */
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export class NoResults extends Feature {
|
|||
}
|
||||
let tf = this.tf;
|
||||
let target = this.customContainer || elm(this.customContainerId) ||
|
||||
tf.tbl;
|
||||
tf.dom();
|
||||
|
||||
//container
|
||||
let cont = createElm('div');
|
||||
|
|
@ -176,8 +176,9 @@ export class NoResults extends Feature {
|
|||
let gridLayout = tf.feature('gridLayout');
|
||||
this.cont.style.width = gridLayout.tblCont.clientWidth + 'px';
|
||||
} else {
|
||||
this.cont.style.width = (tf.tbl.tHead ? tf.tbl.tHead.clientWidth :
|
||||
tf.tbl.tBodies[0].clientWidth) + 'px';
|
||||
this.cont.style.width = (tf.dom().tHead ?
|
||||
tf.dom().tHead.clientWidth :
|
||||
tf.dom().tBodies[0].clientWidth) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ export class Paging extends Feature {
|
|||
*/
|
||||
groupByPage(validRows) {
|
||||
var tf = this.tf;
|
||||
var rows = tf.tbl.rows;
|
||||
var rows = tf.dom().rows;
|
||||
var startPagingRow = parseInt(this.startPagingRow, 10);
|
||||
var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue