1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-16 23:55:46 +01: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
commit 8bd151baef
38 changed files with 378 additions and 429 deletions

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 = " ";
}