1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-12 19:36:41 +02:00

Removed watermark feature, replaced by native HTML5 input placeholder attribute

This commit is contained in:
Max Guglielmi 2015-02-21 14:39:09 +11:00
parent 2b4880e8e8
commit 8bd151baef
38 changed files with 376 additions and 427 deletions

2
dist/filtergrid.css vendored
View file

@ -1,6 +1,6 @@
/*------------------------------------------------------------------------
- TableFilter stylesheet by Max Guglielmi
- (build date: Sat Feb 21 2015 00:45:41)
- (build date: Sat Feb 21 2015 14:36:33)
- Edit below for your projects' needs
------------------------------------------------------------------------*/

8
dist/tablefilter.js vendored

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@ export class AlternateRows{
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.fObj;
var f = tf.config();
//defines css class for even rows
this.evenCss = f.even_row_css_class || 'even';
//defines css class for odd rows
@ -20,7 +20,7 @@ export class AlternateRows{
* Sets alternating rows color
*/
init() {
if(!this.tf.hasGrid && !this.tf.isFirstLoad){
if(!this.tf.hasGrid() && !this.tf.isFirstLoad){
return;
}
var rows = this.tf.tbl.rows;
@ -77,7 +77,7 @@ export class AlternateRows{
* Removes all row background color
*/
remove() {
if(!this.tf.hasGrid){
if(!this.tf.hasGrid()){
return;
}
var row = this.tf.tbl.rows;

View file

@ -12,7 +12,7 @@ export class CheckList{
*/
constructor(tf){
// Configuration object
var f = tf.fObj;
var f = tf.config();
this.checkListDiv = []; //checklist container div
//defines css class for div containing checklist filter
@ -132,7 +132,7 @@ export class CheckList{
(tf.paging && ((!activeFlt || activeFlt===colIndex )||
(activeFlt!=colIndex &&
array.has(tf.validRowsIndex, k))) )))){
var cell_data = tf.GetCellData(j, cells[j]);
var cell_data = tf.getCellData(j, cells[j]);
//Vary Peter's patch
var cell_string = Str.matchCase(
cell_data, tf.matchCase);

View file

@ -9,7 +9,7 @@ export class ClearButton{
*/
constructor(tf){
// Configuration object
var f = tf.fObj;
var f = tf.config();
//id of container element
this.btnResetTgtId = f.btn_reset_target_id || null;
@ -29,7 +29,7 @@ export class ClearButton{
}
onClick(){
this.tf.ClearFilters();
this.tf.clearFilters();
}
/**
@ -38,7 +38,7 @@ export class ClearButton{
init(){
var tf = this.tf;
if(!tf.hasGrid && !tf.isFirstLoad && tf.btnResetEl){
if(!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl){
return;
}
@ -46,7 +46,7 @@ export class ClearButton{
// reset button is added to defined element
if(!this.btnResetTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.btnResetTgtId ?
tf.rDiv : Dom.id(this.btnResetTgtId);
@ -74,7 +74,7 @@ export class ClearButton{
destroy(){
var tf = this.tf;
if(!tf.hasGrid || !this.btnResetEl){
if(!tf.hasGrid() || !this.btnResetEl){
return;
}

View file

@ -9,7 +9,7 @@ export class ColOps{
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.fObj;
var f = tf.config();
this.colOperation = f.col_operation;
//calls function before col operation
@ -39,7 +39,7 @@ export class ColOps{
* (2) added calculations for the median, lower and upper quartile.
*/
calc() {
if(!this.tf.isFirstLoad && !this.tf.hasGrid){
if(!this.tf.isFirstLoad && !this.tf.hasGrid()){
return;
}
@ -88,7 +88,7 @@ export class ColOps{
//use ucolIndex because we only want to pass through this loop
//once for each column get the values in this unique column
colvalues.push(
this.tf.GetColValues(ucolIndex[ucol], true, excludeRow));
this.tf.getColValues(ucolIndex[ucol], true, excludeRow));
//next: calculate all operations for this column
var result,

View file

@ -11,7 +11,7 @@ export class Dropdown{
*/
constructor(tf){
// Configuration object
var f = tf.fObj;
var f = tf.config();
this.enableSlcResetFilter = f.enable_slc_reset_filter ? false : true;
//defines empty option text
@ -138,7 +138,7 @@ export class Dropdown{
((activeFlt===undefined || activeFlt==colIndex) ||
(activeFlt!=colIndex &&
array.has(tf.validRowsIndex, k) ))) ))){
var cell_data = tf.GetCellData(j, cell[j]),
var cell_data = tf.getCellData(j, cell[j]),
//Vary Peter's patch
cell_string = Str.matchCase(cell_data, matchCase);

View file

@ -10,7 +10,7 @@ export class GridLayout{
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.fObj;
var f = tf.config();
//defines grid width
this.gridWidth = f.grid_width || null;
@ -51,7 +51,7 @@ export class GridLayout{
*/
init(){
var tf = this.tf;
var f = tf.fObj;
var f = tf.config();
var tbl = tf.tbl;
if(!tf.gridLayout){
@ -77,7 +77,7 @@ export class GridLayout{
}
tf.hasColWidth = true;
}
tf.SetColWidths(this.gridHeadRowIndex);
tf.setColWidths(this.gridHeadRowIndex);
var tblW;//initial table width
if(tbl.width !== ''){
@ -112,7 +112,7 @@ export class GridLayout{
//In case table width is expressed in %
if(tbl.style.width === ''){
tbl.style.width = (tf.__containsStr('%', tblW) ?
tbl.style.width = (tf._containsStr('%', tblW) ?
tbl.clientWidth : tblW) + 'px';
}
@ -185,7 +185,7 @@ export class GridLayout{
this.headTbl.cellSpacing = tbl.cellSpacing;
//content table without headers needs col widths to be reset
tf.SetColWidths();
tf.setColWidths();
//Headers container width
this.headTblCont.style.width = this.tblCont.clientWidth+'px';
@ -234,7 +234,7 @@ export class GridLayout{
};
tf.hasExtensions = true;
} else {
if(!tf.__containsStr(
if(!tf._containsStr(
'colsresizer',
Str.lower(tf.extensions.src.toString())) ){
tf.extensions.name.push('ColumnsResizer_'+tf.id);

View file

@ -9,7 +9,7 @@ export class Help{
*/
constructor(tf){
// Configuration object
var f = tf.fObj || {};
var f = tf.config();
//id of custom container element for instructions
this.helpInstrTgtId = f.help_instructions_target_id || null;
@ -66,7 +66,7 @@ export class Help{
//help button is added to defined element
if(!this.helpInstrTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.helpInstrTgtId ?
tf.rDiv : Dom.id(this.helpInstrTgtId);

View file

@ -8,7 +8,7 @@ export class HighlightKeyword{
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.fObj;
var f = tf.config();
//defines css class for highlighting
this.highlightCssClass = f.highlight_css_class || 'keyword';
this.highlightedNodes = [];

View file

@ -13,7 +13,7 @@ export class Loader{
constructor(tf){
// TableFilter configuration
var f = tf.fObj;
var f = tf.config();
//id of container element
this.loaderTgtId = f.loader_target_id || null;
//div containing loader
@ -80,8 +80,9 @@ export class Loader{
if(!this.loaderDiv){
return;
}
var targetEl = !this.loaderTgtId ?
(this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode):
var tf = this.tf,
targetEl = !this.loaderTgtId ?
(tf.gridLayout ? tf.Cpt.gridLayout.tblCont : tf.tbl.parentNode):
Dom.id(this.loaderTgtId);
targetEl.removeChild(this.loaderDiv);
this.loaderDiv = null;

View file

@ -12,7 +12,7 @@ export class Paging{
*/
constructor(tf){
// Configuration object
var f = tf.fObj;
var f = tf.config();
//css class for paging buttons (previous,next,etc.)
this.btnPageCssClass = f.paging_btn_css_class || 'pgInp';
@ -127,7 +127,7 @@ export class Paging{
var key = tf.Evt.getKeyCode(e);
if(key===13){
if(tf.sorted){
tf.Filter();
tf.filter();
o.changePage(o.evt.slcIndex());
} else{
o.changePage();
@ -273,7 +273,7 @@ export class Paging{
// paging elements (buttons+drop-down list) are added to defined element
if(!this.pagingTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.pagingTgtId ? tf.mDiv : Dom.id(this.pagingTgtId);
targetEl.appendChild(btnFirstSpan);
@ -317,15 +317,15 @@ export class Paging{
*/
addPaging(filterTable=false){
var tf = this.tf;
if(!tf.hasGrid || tf.paging){
if(!tf.hasGrid() || tf.paging){
return;
}
tf.paging = true;
this.isPagingRemoved = true;
this.init();
tf.ResetValues();
tf.resetValues();
if(filterTable){
tf.Filter();
tf.filter();
}
}
@ -429,7 +429,7 @@ export class Paging{
tf.nbVisibleRows = tf.validRowsIndex.length;
tf.isStartBgAlternate = false;
//re-applies filter behaviours after filtering process
tf.ApplyGridProps();
tf.applyGridProps();
}
/**
@ -439,7 +439,7 @@ export class Paging{
*/
setPage(cmd){
var tf = this.tf;
if(!tf.hasGrid || !this.paging){
if(!tf.hasGrid() || !this.paging){
return;
}
var btnEvt = this.evt,
@ -475,7 +475,7 @@ export class Paging{
var tf = this.tf;
var evt = this.evt;
if(!tf.hasGrid && !tf.isFirstLoad){
if(!tf.hasGrid() && !tf.isFirstLoad){
return;
}
if(this.resultsPerPageSlc || !this.resultsPerPage){
@ -501,7 +501,7 @@ export class Paging{
// results per page select is added to external element
if(!this.resultsPerPageTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.resultsPerPageTgtId ?
tf.rDiv : Dom.id(this.resultsPerPageTgtId);
@ -523,7 +523,7 @@ export class Paging{
*/
removeResultsPerPage(){
var tf = this.tf;
if(!tf.hasGrid || !this.resultsPerPageSlc || !this.resultsPerPage){
if(!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage){
return;
}
var slcR = this.resultsPerPageSlc,
@ -680,7 +680,7 @@ export class Paging{
destroy(){
var tf = this.tf;
if(!tf.hasGrid){
if(!tf.hasGrid()){
return;
}
// btns containers

View file

@ -11,7 +11,7 @@ export class PopupFilter{
*/
constructor(tf){
// Configuration object
var f = tf.fObj;
var f = tf.config();
// Enable external filters behaviour
tf.isExternalFlt = true;
@ -62,7 +62,7 @@ export class PopupFilter{
if(this.popUpFltAdjustToContainer){
var popUpDiv = this.popUpFltElms[colIndex],
header = this.tf.GetHeaderElement(colIndex),
header = this.tf.getHeaderElement(colIndex),
headerWidth = header.clientWidth * 0.95;
if(Helpers.isIE()){
var headerLeft = Dom.position(header).left;
@ -89,7 +89,7 @@ export class PopupFilter{
['ci', i]
);
popUpSpan.innerHTML = this.popUpImgFltHtml;
var header = tf.GetHeaderElement(i);
var header = tf.getHeaderElement(i);
header.appendChild(popUpSpan);
Event.add(popUpSpan, 'click', (evt) => { this.onClick(evt); });
this.popUpFltSpans[i] = popUpSpan;
@ -118,9 +118,8 @@ export class PopupFilter{
div;
popUpDiv.className = this.popUpDivCssClass;
tf.externalFltTgtIds.push(popUpDiv.id);
var header = tf.GetHeaderElement(colIndex);
var header = tf.getHeaderElement(colIndex);
header.insertBefore(popUpDiv, header.firstChild);
//popUpDiv.onclick = function(e){ evt.stop(e || global.event); };
Event.add(popUpDiv, 'click', (evt) => { Event.stop(evt); });
this.popUpFltElms[colIndex] = popUpDiv;
}

View file

@ -10,7 +10,7 @@ export class RowsCounter{
*/
constructor(tf){
// TableFilter configuration
var f = tf.fObj;
var f = tf.config();
//id of custom container element
this.rowsCounterTgtId = f.rows_counter_target_id || null;
@ -37,7 +37,7 @@ export class RowsCounter{
init(){
var tf = this.tf;
if((!tf.hasGrid && !tf.isFirstLoad) || this.rowsCounterSpan){
if((!tf.hasGrid() && !tf.isFirstLoad) || this.rowsCounterSpan){
return;
}
@ -51,7 +51,7 @@ export class RowsCounter{
// counter is added to defined element
if(!this.rowsCounterTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.rowsCounterTgtId ?
tf.lDiv : Dom.id( this.rowsCounterTgtId );
@ -119,7 +119,7 @@ export class RowsCounter{
destroy(){
var tf = this.tf;
if(!tf.hasGrid){
if(!tf.hasGrid()){
return;
}
if(!this.rowsCounterSpan){

View file

@ -3,6 +3,8 @@ import {Event} from '../event';
import {Types} from '../types';
import {Helpers} from '../helpers';
var global = window;
export class StatusBar{
/**
@ -11,7 +13,7 @@ export class StatusBar{
*/
constructor(tf){
// Configuration object
var f = tf.fObj || {};
var f = tf.config();
//id of custom container element
this.statusBarTgtId = f.status_bar_target_id || null;
@ -40,7 +42,7 @@ export class StatusBar{
init(){
var tf = this.tf;
if(!tf.hasGrid && !tf.isFirstLoad){
if(!tf.hasGrid() && !tf.isFirstLoad){
return;
}
@ -56,7 +58,7 @@ export class StatusBar{
// target element container
if(!this.statusBarTgtId){
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = (!this.statusBarTgtId) ?
tf.lDiv : Dom.id(this.statusBarTgtId);
@ -93,7 +95,7 @@ export class StatusBar{
}
var d = t==='' ? this.statusBarCloseDelay : 1;
window.setTimeout(() => {
global.setTimeout(() => {
this.statusBarSpan.innerHTML = t;
if(this.onAfterShowMsg){
this.onAfterShowMsg.call(null, this.tf, t);
@ -103,7 +105,7 @@ export class StatusBar{
destroy(){
var tf = this.tf;
if(!tf.hasGrid || !this.statusBarDiv){
if(!tf.hasGrid() || !this.statusBarDiv){
return;
}

View file

@ -7,7 +7,7 @@ export class Store{
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.fObj;
var f = tf.config();
this.duration = !isNaN(f.set_cookie_duration) ?
parseInt(f.set_cookie_duration, 10) : 100000;
@ -24,7 +24,7 @@ export class Store{
var fltValues = [];
//store filters' values
for(var i=0; i<tf.fltIds.length; i++){
var value = tf.GetFilterValue(i);
var value = tf.getFilterValue(i);
if (value === ''){
value = ' ';
}

File diff suppressed because it is too large Load diff

View file

@ -104,18 +104,19 @@
// remember_page_number: true,
// remember_page_length: true,
fill_slc_on_demand: false,
refresh_filters: false,
linked_filters: false,
popup_filters: false,
alternate_rows: true,
highlight_keywords: true,
match_case: false,
btn_reset: true,
status_bar: true,
// grid_layout: true,
watermark: [null, 'Filter column...', null, null, 'Helo'],
grid_layout: false,
// grid_width: '500px',
// grid_height: '200px',
on_before_show_msg: function(tf){
console.log('on_before_show_msg');
// console.log('on_before_show_msg');
}
});

View file

@ -9,7 +9,7 @@ define(["exports", "../dom"], function (exports, _dom) {
var Dom = _dom.Dom;
var AlternateRows = (function () {
var AlternateRows = function AlternateRows(tf) {
var f = tf.fObj;
var f = tf.config();
//defines css class for even rows
this.evenCss = f.even_row_css_class || "even";
//defines css class for odd rows
@ -22,7 +22,7 @@ define(["exports", "../dom"], function (exports, _dom) {
init: {
writable: true,
value: function () {
if (!this.tf.hasGrid && !this.tf.isFirstLoad) {
if (!this.tf.hasGrid() && !this.tf.isFirstLoad) {
return;
}
var rows = this.tf.tbl.rows;
@ -67,7 +67,7 @@ define(["exports", "../dom"], function (exports, _dom) {
remove: {
writable: true,
value: function () {
if (!this.tf.hasGrid) {
if (!this.tf.hasGrid()) {
return;
}
var row = this.tf.tbl.rows;

View file

@ -14,7 +14,7 @@ define(["exports", "../dom", "../array", "../string", "../sort", "../event"], fu
var CheckList = (function () {
var CheckList = function CheckList(tf) {
// Configuration object
var f = tf.fObj;
var f = tf.config();
this.checkListDiv = []; //checklist container div
//defines css class for div containing checklist filter
@ -115,7 +115,7 @@ define(["exports", "../dom", "../array", "../string", "../sort", "../event"], fu
// this loop retrieves cell data
for (var j = 0; j < ncells; j++) {
if ((colIndex === j && (!tf.refreshFilters || (tf.refreshFilters && tf.disableExcludedOptions))) || (colIndex === j && tf.refreshFilters && ((rows[k].style.display === "" && !tf.paging) || (tf.paging && ((!activeFlt || activeFlt === colIndex) || (activeFlt != colIndex && array.has(tf.validRowsIndex, k))))))) {
var cell_data = tf.GetCellData(j, cells[j]);
var cell_data = tf.getCellData(j, cells[j]);
//Vary Peter's patch
var cell_string = Str.matchCase(cell_data, tf.matchCase);
// checks if celldata is already in array

View file

@ -11,7 +11,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
var ClearButton = (function () {
var ClearButton = function ClearButton(tf) {
// Configuration object
var f = tf.fObj;
var f = tf.config();
//id of container element
this.btnResetTgtId = f.btn_reset_target_id || null;
@ -31,7 +31,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
onClick: {
writable: true,
value: function () {
this.tf.ClearFilters();
this.tf.clearFilters();
}
},
init: {
@ -40,7 +40,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
var _this = this;
var tf = this.tf;
if (!tf.hasGrid && !tf.isFirstLoad && tf.btnResetEl) {
if (!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl) {
return;
}
@ -48,7 +48,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
// reset button is added to defined element
if (!this.btnResetTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.btnResetTgtId ? tf.rDiv : Dom.id(this.btnResetTgtId);
targetEl.appendChild(resetspan);
@ -78,7 +78,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
value: function () {
var tf = this.tf;
if (!tf.hasGrid || !this.btnResetEl) {
if (!tf.hasGrid() || !this.btnResetEl) {
return;
}

View file

@ -11,7 +11,7 @@ define(["exports", "../dom", "../string", "../types"], function (exports, _dom,
var Types = _types.Types;
var ColOps = (function () {
var ColOps = function ColOps(tf) {
var f = tf.fObj;
var f = tf.config();
this.colOperation = f.col_operation;
//calls function before col operation
@ -26,7 +26,7 @@ define(["exports", "../dom", "../string", "../types"], function (exports, _dom,
calc: {
writable: true,
value: function () {
if (!this.tf.isFirstLoad && !this.tf.hasGrid) {
if (!this.tf.isFirstLoad && !this.tf.hasGrid()) {
return;
}
@ -62,7 +62,7 @@ define(["exports", "../dom", "../string", "../types"], function (exports, _dom,
//this retrieves col values
//use ucolIndex because we only want to pass through this loop
//once for each column get the values in this unique column
colvalues.push(this.tf.GetColValues(ucolIndex[ucol], true, excludeRow));
colvalues.push(this.tf.getColValues(ucolIndex[ucol], true, excludeRow));
//next: calculate all operations for this column
var result, nbvalues = 0, temp, meanValue = 0, sumValue = 0, minValue = null, maxValue = null, q1Value = null, medValue = null, q3Value = null, meanFlag = 0, sumFlag = 0, minFlag = 0, maxFlag = 0, q1Flag = 0, medFlag = 0, q3Flag = 0, theList = [], opsThisCol = [], decThisCol = [], labThisCol = [], oTypeThisCol = [], mThisCol = -1;

View file

@ -13,7 +13,7 @@ define(["exports", "../dom", "../array", "../string", "../sort"], function (expo
var Dropdown = (function () {
var Dropdown = function Dropdown(tf) {
// Configuration object
var f = tf.fObj;
var f = tf.config();
this.enableSlcResetFilter = f.enable_slc_reset_filter ? false : true;
//defines empty option text
@ -111,7 +111,7 @@ define(["exports", "../dom", "../array", "../string", "../sort"], function (expo
// this loop retrieves cell data
for (var j = 0; j < nchilds; j++) {
if ((colIndex === j && (!isRefreshed || (isRefreshed && tf.disableExcludedOptions))) || (colIndex == j && isRefreshed && ((rows[k].style.display === "" && !tf.paging) || (tf.paging && (!tf.validRowsIndex || (tf.validRowsIndex && array.has(tf.validRowsIndex, k))) && ((activeFlt === undefined || activeFlt == colIndex) || (activeFlt != colIndex && array.has(tf.validRowsIndex, k))))))) {
var cell_data = tf.GetCellData(j, cell[j]),
var cell_data = tf.getCellData(j, cell[j]),
//Vary Peter's patch
cell_string = Str.matchCase(cell_data, matchCase);

View file

@ -12,7 +12,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
var Event = _event.Event;
var GridLayout = (function () {
var GridLayout = function GridLayout(tf) {
var f = tf.fObj;
var f = tf.config();
//defines grid width
this.gridWidth = f.grid_width || null;
@ -49,7 +49,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
writable: true,
value: function () {
var tf = this.tf;
var f = tf.fObj;
var f = tf.config();
var tbl = tf.tbl;
if (!tf.gridLayout) {
@ -74,7 +74,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
}
tf.hasColWidth = true;
}
tf.SetColWidths(this.gridHeadRowIndex);
tf.setColWidths(this.gridHeadRowIndex);
var tblW; //initial table width
if (tbl.width !== "") {
@ -108,7 +108,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
//In case table width is expressed in %
if (tbl.style.width === "") {
tbl.style.width = (tf.__containsStr("%", tblW) ? tbl.clientWidth : tblW) + "px";
tbl.style.width = (tf._containsStr("%", tblW) ? tbl.clientWidth : tblW) + "px";
}
var d = this.tblCont.parentNode.removeChild(this.tblCont);
@ -179,7 +179,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
this.headTbl.cellSpacing = tbl.cellSpacing;
//content table without headers needs col widths to be reset
tf.SetColWidths();
tf.setColWidths();
//Headers container width
this.headTblCont.style.width = this.tblCont.clientWidth + "px";
@ -227,7 +227,7 @@ define(["exports", "../dom", "../types", "../helpers", "../event"], function (ex
};
tf.hasExtensions = true;
} else {
if (!tf.__containsStr("colsresizer", Str.lower(tf.extensions.src.toString()))) {
if (!tf._containsStr("colsresizer", Str.lower(tf.extensions.src.toString()))) {
tf.extensions.name.push("ColumnsResizer_" + tf.id);
tf.extensions.src.push(tf.gridColResizerPath);
tf.extensions.description.push("Columns Resizing");

View file

@ -11,7 +11,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
var Help = (function () {
var Help = function Help(tf) {
// Configuration object
var f = tf.fObj || {};
var f = tf.config();
//id of custom container element for instructions
this.helpInstrTgtId = f.help_instructions_target_id || null;
@ -54,7 +54,7 @@ define(["exports", "../dom", "../event"], function (exports, _dom, _event) {
//help button is added to defined element
if (!this.helpInstrTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.helpInstrTgtId ? tf.rDiv : Dom.id(this.helpInstrTgtId);
targetEl.appendChild(helpspan);

View file

@ -10,7 +10,7 @@ define(["exports", "../dom", "../string"], function (exports, _dom, _string) {
var Str = _string.Str;
var HighlightKeyword = (function () {
var HighlightKeyword = function HighlightKeyword(tf) {
var f = tf.fObj;
var f = tf.config();
//defines css class for highlighting
this.highlightCssClass = f.highlight_css_class || "keyword";
this.highlightedNodes = [];

View file

@ -15,7 +15,7 @@ define(["exports", "../dom", "../types"], function (exports, _dom, _types) {
var Loader = (function () {
var Loader = function Loader(tf) {
// TableFilter configuration
var f = tf.fObj;
var f = tf.config();
//id of container element
this.loaderTgtId = f.loader_target_id || null;
//div containing loader
@ -84,7 +84,7 @@ define(["exports", "../dom", "../types"], function (exports, _dom, _types) {
if (!this.loaderDiv) {
return;
}
var targetEl = !this.loaderTgtId ? (this.tf.gridLayout ? this.tf.tblCont : this.tf.tbl.parentNode) : Dom.id(this.loaderTgtId);
var tf = this.tf, targetEl = !this.loaderTgtId ? (tf.gridLayout ? tf.Cpt.gridLayout.tblCont : tf.tbl.parentNode) : Dom.id(this.loaderTgtId);
targetEl.removeChild(this.loaderDiv);
this.loaderDiv = null;
}

View file

@ -14,7 +14,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
var Paging = (function () {
var Paging = function Paging(tf) {
// Configuration object
var f = tf.fObj;
var f = tf.config();
//css class for paging buttons (previous,next,etc.)
this.btnPageCssClass = f.paging_btn_css_class || "pgInp";
@ -109,7 +109,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
var key = tf.Evt.getKeyCode(e);
if (key === 13) {
if (tf.sorted) {
tf.Filter();
tf.filter();
o.changePage(o.evt.slcIndex());
} else {
o.changePage();
@ -223,7 +223,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
// paging elements (buttons+drop-down list) are added to defined element
if (!this.pagingTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.pagingTgtId ? tf.mDiv : Dom.id(this.pagingTgtId);
targetEl.appendChild(btnFirstSpan);
@ -264,15 +264,15 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
value: function (filterTable) {
if (filterTable === undefined) filterTable = false;
var tf = this.tf;
if (!tf.hasGrid || tf.paging) {
if (!tf.hasGrid() || tf.paging) {
return;
}
tf.paging = true;
this.isPagingRemoved = true;
this.init();
tf.ResetValues();
tf.resetValues();
if (filterTable) {
tf.Filter();
tf.filter();
}
}
},
@ -363,14 +363,14 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
tf.nbVisibleRows = tf.validRowsIndex.length;
tf.isStartBgAlternate = false;
//re-applies filter behaviours after filtering process
tf.ApplyGridProps();
tf.applyGridProps();
}
},
setPage: {
writable: true,
value: function (cmd) {
var tf = this.tf;
if (!tf.hasGrid || !this.paging) {
if (!tf.hasGrid() || !this.paging) {
return;
}
var btnEvt = this.evt, cmdtype = typeof cmd;
@ -404,7 +404,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
var tf = this.tf;
var evt = this.evt;
if (!tf.hasGrid && !tf.isFirstLoad) {
if (!tf.hasGrid() && !tf.isFirstLoad) {
return;
}
if (this.resultsPerPageSlc || !this.resultsPerPage) {
@ -427,7 +427,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
// results per page select is added to external element
if (!this.resultsPerPageTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.resultsPerPageTgtId ? tf.rDiv : Dom.id(this.resultsPerPageTgtId);
slcRSpan.appendChild(Dom.text(slcRText));
@ -447,7 +447,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
writable: true,
value: function () {
var tf = this.tf;
if (!tf.hasGrid || !this.resultsPerPageSlc || !this.resultsPerPage) {
if (!tf.hasGrid() || !this.resultsPerPageSlc || !this.resultsPerPage) {
return;
}
var slcR = this.resultsPerPageSlc, slcRSpan = Dom.id(tf.prfxSlcResultsTxt + tf.id);
@ -586,7 +586,7 @@ define(["exports", "../dom", "../types", "../string", "../helpers", "../event"],
value: function () {
var tf = this.tf;
if (!tf.hasGrid) {
if (!tf.hasGrid()) {
return;
}
// btns containers

View file

@ -13,7 +13,7 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
var PopupFilter = (function () {
var PopupFilter = function PopupFilter(tf) {
// Configuration object
var f = tf.fObj;
var f = tf.config();
// Enable external filters behaviour
tf.isExternalFlt = true;
@ -56,7 +56,7 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
this.toggle(colIndex);
if (this.popUpFltAdjustToContainer) {
var popUpDiv = this.popUpFltElms[colIndex], header = this.tf.GetHeaderElement(colIndex), headerWidth = header.clientWidth * 0.95;
var popUpDiv = this.popUpFltElms[colIndex], header = this.tf.getHeaderElement(colIndex), headerWidth = header.clientWidth * 0.95;
if (Helpers.isIE()) {
var headerLeft = Dom.position(header).left;
popUpDiv.style.left = (headerLeft) + "px";
@ -78,7 +78,7 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
}
var popUpSpan = Dom.create("span", ["id", tf.prfxPopUpSpan + tf.id + "_" + i], ["ci", i]);
popUpSpan.innerHTML = this.popUpImgFltHtml;
var header = tf.GetHeaderElement(i);
var header = tf.getHeaderElement(i);
header.appendChild(popUpSpan);
Event.add(popUpSpan, "click", function (evt) {
_this.onClick(evt);
@ -103,9 +103,8 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
var popUpDiv = !div ? Dom.create("div", ["id", tf.prfxPopUpDiv + tf.id + "_" + colIndex]) : div;
popUpDiv.className = this.popUpDivCssClass;
tf.externalFltTgtIds.push(popUpDiv.id);
var header = tf.GetHeaderElement(colIndex);
var header = tf.getHeaderElement(colIndex);
header.insertBefore(popUpDiv, header.firstChild);
//popUpDiv.onclick = function(e){ evt.stop(e || global.event); };
Event.add(popUpDiv, "click", function (evt) {
Event.stop(evt);
});

View file

@ -12,7 +12,7 @@ define(["exports", "../dom", "../types", "../helpers"], function (exports, _dom,
var RowsCounter = (function () {
var RowsCounter = function RowsCounter(tf) {
// TableFilter configuration
var f = tf.fObj;
var f = tf.config();
//id of custom container element
this.rowsCounterTgtId = f.rows_counter_target_id || null;
@ -40,7 +40,7 @@ define(["exports", "../dom", "../types", "../helpers"], function (exports, _dom,
value: function () {
var tf = this.tf;
if ((!tf.hasGrid && !tf.isFirstLoad) || this.rowsCounterSpan) {
if ((!tf.hasGrid() && !tf.isFirstLoad) || this.rowsCounterSpan) {
return;
}
@ -54,7 +54,7 @@ define(["exports", "../dom", "../types", "../helpers"], function (exports, _dom,
// counter is added to defined element
if (!this.rowsCounterTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = !this.rowsCounterTgtId ? tf.lDiv : Dom.id(this.rowsCounterTgtId);
@ -117,7 +117,7 @@ define(["exports", "../dom", "../types", "../helpers"], function (exports, _dom,
writable: true,
value: function () {
var tf = this.tf;
if (!tf.hasGrid) {
if (!tf.hasGrid()) {
return;
}
if (!this.rowsCounterSpan) {

View file

@ -10,10 +10,14 @@ define(["exports", "../dom", "../event", "../types", "../helpers"], function (ex
var Event = _event.Event;
var Types = _types.Types;
var Helpers = _helpers.Helpers;
var global = window;
var StatusBar = (function () {
var StatusBar = function StatusBar(tf) {
// Configuration object
var f = tf.fObj || {};
var f = tf.config();
//id of custom container element
this.statusBarTgtId = f.status_bar_target_id || null;
@ -43,7 +47,7 @@ define(["exports", "../dom", "../event", "../types", "../helpers"], function (ex
writable: true,
value: function () {
var tf = this.tf;
if (!tf.hasGrid && !tf.isFirstLoad) {
if (!tf.hasGrid() && !tf.isFirstLoad) {
return;
}
@ -59,7 +63,7 @@ define(["exports", "../dom", "../event", "../types", "../helpers"], function (ex
// target element container
if (!this.statusBarTgtId) {
tf.SetTopDiv();
tf.setToolbar();
}
var targetEl = (!this.statusBarTgtId) ? tf.lDiv : Dom.id(this.statusBarTgtId);
@ -98,7 +102,7 @@ define(["exports", "../dom", "../event", "../types", "../helpers"], function (ex
}
var d = t === "" ? this.statusBarCloseDelay : 1;
window.setTimeout(function () {
global.setTimeout(function () {
_this.statusBarSpan.innerHTML = t;
if (_this.onAfterShowMsg) {
_this.onAfterShowMsg.call(null, _this.tf, t);
@ -110,7 +114,7 @@ define(["exports", "../dom", "../event", "../types", "../helpers"], function (ex
writable: true,
value: function () {
var tf = this.tf;
if (!tf.hasGrid || !this.statusBarDiv) {
if (!tf.hasGrid() || !this.statusBarDiv) {
return;
}

View file

@ -9,7 +9,7 @@ define(["exports", "../cookie"], function (exports, _cookie) {
var Cookie = _cookie.Cookie;
var Store = (function () {
var Store = function Store(tf) {
var f = tf.fObj;
var f = tf.config();
this.duration = !isNaN(f.set_cookie_duration) ? parseInt(f.set_cookie_duration, 10) : 100000;
@ -24,7 +24,7 @@ define(["exports", "../cookie"], function (exports, _cookie) {
var fltValues = [];
//store filters' values
for (var i = 0; i < tf.fltIds.length; i++) {
var value = tf.GetFilterValue(i);
var value = tf.getFilterValue(i);
if (value === "") {
value = " ";
}

View file

@ -28,7 +28,7 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
});
test('TableFilter removed', function() {
tf.RemoveGrid();
tf.remove();
deepEqual(dom.id(tf.fltIds[3]), null, 'CheckList UL element');
});
});

View file

@ -31,7 +31,7 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
});
test('TableFilter removed', function() {
tf.RemoveGrid();
tf.remove();
deepEqual(dom.id(tf.fltIds[3]), null, 'Filter is removed');
});

View file

@ -19,13 +19,13 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
});
test('Highlighted keywords', function() {
tf.SetFilterValue(1, 'Perth');
tf.SetFilterValue(3, '3.1');
tf._Filter();
tf.setFilterValue(1, 'Perth');
tf.setFilterValue(3, '3.1');
tf._filter();
deepEqual(highlightKeyword.highlightedNodes.length, 2, 'Number of highlighted words');
tf._ClearFilters();
tf._Filter();
tf._clearFilters();
tf._filter();
deepEqual(highlightKeyword.highlightedNodes.length, 0, 'Number of highlighted words');
});
});

View file

@ -35,7 +35,7 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
});
test('TableFilter removed', function() {
tf.RemoveGrid();
tf.remove();
var fltIcn1 = tf.Cpt.popupFilter.popUpFltImgs[3];
deepEqual(fltIcn1, undefined, 'Filter icon is removed');
deepEqual(dom.id(tf.fltIds[3]), null, 'Filter is removed');

View file

@ -19,7 +19,7 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
Cookie.remove(tf.pgLenCookie);
tf.init();
tf._ClearFilters();
tf._clearFilters();
module('Sanity checks');
test('Store module', function() {
@ -30,13 +30,13 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
module('Check page number persistence');
test('Page number value', function() {
tf._ClearFilters();
tf._Filter();
tf._clearFilters();
tf._filter();
tf.Cpt.paging._changePage(1);
var cookieName = tf.pgNbCookie;
deepEqual(tf.Cpt.store.getPageNb(cookieName), '2', 'Page number value');
tf._ClearFilters();
tf._Filter();
tf._clearFilters();
tf._filter();
});
module('Check page length persistence');
@ -46,20 +46,20 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
paging._changeResultsPerPage();
var cookieName = tf.pgLenCookie;
deepEqual(tf.Cpt.store.getPageLength(cookieName), '2', 'Page length value');
tf._ClearFilters();
tf._Filter();
tf._clearFilters();
tf._filter();
});
module('Check filters persistence');
test('Filters value', function() {
tf.SetFilterValue(0, 'Sydney');
tf.SetFilterValue(3, '1.5');
tf._Filter();
tf.setFilterValue(0, 'Sydney');
tf.setFilterValue(3, '1.5');
tf._filter();
var cookieName = tf.fltsValuesCookie;
deepEqual(tf.Cpt.store.getFilterValues(cookieName)[0], 'Sydney', 'Filter 0 value');
deepEqual(tf.Cpt.store.getFilterValues(cookieName)[3], '1.5', 'Filter 3 value');
tf._ClearFilters();
tf._Filter();
tf._clearFilters();
tf._filter();
});
});

View file

@ -15,7 +15,7 @@ requirejs(['test-config', '../src/core'], function(config, TableFilter){
module('DOM tests');
test('Filters row', function() {
equal(tf.tbl.rows[0].className, 'fltrow', 'Filters row CSS class name');
equal(tf.GetFilterElement(0).nodeName, 'INPUT', 'Filter DOM element');
equal(tf.getFilterElement(0).nodeName, 'INPUT', 'Filter DOM element');
});
});