mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-13 11:56:46 +02:00
Init formatting
This commit is contained in:
parent
620b22d228
commit
e41d3a631c
|
@ -30,7 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
Raya, Piepiax, Manuel Kern, Baladhandayutham for active contribution
|
||||
and/or inspiration
|
||||
------------------------------------------------------------------------*/
|
||||
var TF = (function() {
|
||||
|
||||
/**
|
||||
* TF object constructor
|
||||
|
@ -44,7 +43,7 @@ var TF = (function() {
|
|||
this.version = '2.5';
|
||||
this.year = new Date().getFullYear();
|
||||
this.tbl = tf_Id(id);
|
||||
this.startRow = undefined;
|
||||
this.startRow = null;
|
||||
this.refRow = null;
|
||||
this.headersRow = null;
|
||||
this.fObj = null;
|
||||
|
@ -75,10 +74,11 @@ var TF = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
var f = !this.fObj ? {} : this.fObj;
|
||||
// configuration object
|
||||
var f = this.fObj || {};
|
||||
|
||||
//Start row et cols nb
|
||||
this.refRow = this.startRow===undefined ? 2 : (this.startRow+1);
|
||||
this.refRow = this.startRow===null ? 2 : (this.startRow+1);
|
||||
try{ this.nbCells = this.GetCellsNb(this.refRow); }
|
||||
catch(e){ this.nbCells = this.GetCellsNb(0); }
|
||||
|
||||
|
@ -706,18 +706,19 @@ var TF = (function() {
|
|||
loadextensions: 'LoadExtensions',
|
||||
loadthemes: 'LoadThemes'
|
||||
},
|
||||
getKeyCode: function(e){
|
||||
return e.charCode ? evt.charCode :
|
||||
(evt.keyCode ? evt.keyCode: (evt.which ? evt.which : 0));
|
||||
},
|
||||
/*====================================================
|
||||
- Detects <enter> key for a given element
|
||||
=====================================================*/
|
||||
_DetectKey: function(e) {
|
||||
if(!o.enterKey) return;
|
||||
if(!o.enterKey){ return; }
|
||||
var evt = e || window.event;
|
||||
if(evt)
|
||||
{
|
||||
var key=(evt.charCode)?evt.charCode:
|
||||
((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
|
||||
if(key=='13')
|
||||
{
|
||||
if(evt){
|
||||
var key = o.Evt.getKeyCode(evt);
|
||||
if(key===13){
|
||||
o._Filter();
|
||||
tf_CancelEvent(evt);
|
||||
tf_StopEvent(evt);
|
||||
|
@ -734,11 +735,9 @@ var TF = (function() {
|
|||
_OnKeyUp: function(e) {
|
||||
if(!o.onKeyUp) return;
|
||||
var evt = e || window.event;
|
||||
var key=(evt.charCode)?evt.charCode:
|
||||
((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
|
||||
var key = o.Evt.getKeyCode(evt);
|
||||
o.isUserTyping = false;
|
||||
|
||||
if(key!=13 && key!=9 && key!=27 && key!=38 && key!=40) {
|
||||
function filter() {
|
||||
window.clearInterval(o.onKeyUpTimer);
|
||||
o.onKeyUpTimer = undefined;
|
||||
|
@ -748,8 +747,11 @@ var TF = (function() {
|
|||
o.isUserTyping = null;
|
||||
}
|
||||
}
|
||||
if(o.onKeyUpTimer===undefined)
|
||||
|
||||
if(key!==13 && key!==9 && key!==27 && key!==38 && key!==40) {
|
||||
if(o.onKeyUpTimer===undefined){
|
||||
o.onKeyUpTimer = window.setInterval(filter, o.onKeyUpDelay);
|
||||
}
|
||||
} else {
|
||||
window.clearInterval(o.onKeyUpTimer);
|
||||
o.onKeyUpTimer = undefined;
|
||||
|
@ -915,80 +917,103 @@ var TF = (function() {
|
|||
|
||||
TF.prototype = {
|
||||
|
||||
AddGrid: function()
|
||||
{
|
||||
this._AddGrid();
|
||||
}, Init : function(){ this.AddGrid(); }, Initialize : function(){ this.AddGrid(); },
|
||||
init : function(){ this.AddGrid(); }, initialize : function(){ this.AddGrid(); },
|
||||
|
||||
_AddGrid: function()
|
||||
AddGrid: function(){ this._AddGrid();},
|
||||
Init: function(){ this.AddGrid(); },
|
||||
Initialize: function(){ this.AddGrid(); },
|
||||
init: function(){ this.AddGrid(); },
|
||||
initialize: function(){ this.AddGrid(); },
|
||||
/*====================================================
|
||||
- adds row with filtering grid bar and sets grid
|
||||
behaviours and layout
|
||||
=====================================================*/
|
||||
{
|
||||
_AddGrid: function(){
|
||||
if(this.hasGrid) return;
|
||||
if(this.gridLayout) this.refRow = this.startRow==undefined ? 0 : this.startRow;
|
||||
if(this.popUpFilters && ((this.filtersRowIndex==0 && this.headersRow == 1) || this.gridLayout)) this.headersRow = 0;
|
||||
var f = !this.fObj ? {} : this.fObj;
|
||||
var n = (this.singleSearchFlt) ? 1 : this.nbCells, inpclass;
|
||||
if(window['tf_'+this.id] == undefined) window['tf_'+this.id] = this;
|
||||
if(this.gridLayout){
|
||||
this.refRow = this.startRow===null ? 0 : this.startRow;
|
||||
}
|
||||
if(this.popUpFilters &&
|
||||
((this.filtersRowIndex === 0 && this.headersRow === 1) ||
|
||||
this.gridLayout)){
|
||||
this.headersRow = 0;
|
||||
}
|
||||
var f = this.fObj || {},
|
||||
n = this.singleSearchFlt ? 1 : this.nbCells,
|
||||
inpclass;
|
||||
|
||||
if(window['tf_'+this.id] === undefined){
|
||||
window['tf_'+this.id] = this;
|
||||
}
|
||||
|
||||
//loads stylesheet if not imported
|
||||
//Issues with browsers != IE, IE rules in this case
|
||||
this.IncludeFile(this.stylesheetId, this.stylesheet, null, 'link');
|
||||
|
||||
//loads theme
|
||||
if(this.hasThemes) this._LoadThemes();
|
||||
if(this.hasThemes){ this._LoadThemes(); }
|
||||
|
||||
if(this.gridLayout)
|
||||
{
|
||||
if(this.gridLayout){
|
||||
this.isExternalFlt = true;
|
||||
this.SetGridLayout();
|
||||
//Once grid generated 1st filterable row is 0 again
|
||||
this.refRow = (tf_isIE || tf_isIE7) ? (this.refRow+1) : 0;
|
||||
}
|
||||
|
||||
if(this.loader) this.SetLoader();
|
||||
if(this.loader){ this.SetLoader(); }
|
||||
|
||||
if(this.popUpFilters){ if(!this.isFirstLoad && !this.gridLayout){ this.headersRow--; } this.SetPopupFilterIcons(); }
|
||||
|
||||
if(this.hasResultsPerPage)
|
||||
{
|
||||
this.resultsPerPage = f['results_per_page']!=undefined
|
||||
? f['results_per_page'] : this.resultsPerPage;
|
||||
if(this.resultsPerPage.length<2)
|
||||
this.hasResultsPerPage = false;
|
||||
else
|
||||
this.pagingLength = this.resultsPerPage[1][0];
|
||||
if(this.popUpFilters){
|
||||
if(!this.isFirstLoad && !this.gridLayout){
|
||||
this.headersRow--;
|
||||
}
|
||||
this.SetPopupFilterIcons();
|
||||
}
|
||||
|
||||
if(!this.fltGrid)
|
||||
{//filters grid is not genetared
|
||||
this.refRow = (this.refRow-1);
|
||||
if(this.gridLayout) this.refRow = 0;
|
||||
if(this.hasResultsPerPage){
|
||||
this.resultsPerPage = f['results_per_page'] || this.resultsPerPage;
|
||||
if(this.resultsPerPage.length<2){
|
||||
this.hasResultsPerPage = false;
|
||||
} else {
|
||||
this.pagingLength = this.resultsPerPage[1][0];
|
||||
}
|
||||
}
|
||||
|
||||
//filters grid is not generated
|
||||
if(!this.fltGrid){
|
||||
this.refRow = this.refRow-1;
|
||||
if(this.gridLayout){
|
||||
this.refRow = 0;
|
||||
}
|
||||
this.nbFilterableRows = this.GetRowsNb();
|
||||
this.nbVisibleRows = this.nbFilterableRows;
|
||||
this.nbRows = this.nbFilterableRows + this.refRow;
|
||||
} else {
|
||||
if(this.isFirstLoad)
|
||||
{
|
||||
if(!this.gridLayout){
|
||||
if(this.isFirstLoad){
|
||||
var fltrow;
|
||||
if(!this.gridLayout){
|
||||
var thead = tf_Tag(this.tbl,'thead');
|
||||
if(thead.length>0)
|
||||
if(thead.length > 0){
|
||||
fltrow = thead[0].insertRow(this.filtersRowIndex);
|
||||
else
|
||||
} else {
|
||||
fltrow = this.tbl.insertRow(this.filtersRowIndex);
|
||||
}
|
||||
|
||||
if(this.headersRow>1 && this.filtersRowIndex <= this.headersRow && !this.popUpFilters) this.headersRow++;
|
||||
if(this.popUpFilters) this.headersRow++;
|
||||
|
||||
if(this.fixedHeaders) this.SetFixedHeaders();
|
||||
if(this.headersRow > 1 &&
|
||||
this.filtersRowIndex <= this.headersRow &&
|
||||
!this.popUpFilters){
|
||||
this.headersRow++;
|
||||
}
|
||||
if(this.popUpFilters){
|
||||
this.headersRow++;
|
||||
}
|
||||
if(this.fixedHeaders){
|
||||
this.SetFixedHeaders();
|
||||
}
|
||||
|
||||
fltrow.className = this.fltsRowCssClass;
|
||||
//Disable for grid_layout
|
||||
if(this.isExternalFlt && (!this.gridLayout || this.popUpFilters)) fltrow.style.display = 'none';
|
||||
if(this.isExternalFlt &&
|
||||
(!this.gridLayout || this.popUpFilters)){
|
||||
fltrow.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
this.nbFilterableRows = this.GetRowsNb();
|
||||
|
@ -996,39 +1021,53 @@ var TF = (function() {
|
|||
this.nbRows = this.tbl.rows.length;
|
||||
|
||||
for(var i=0; i<n; i++){// this loop adds filters
|
||||
var fltcell = tf_CreateElm(this.fltCellTag);
|
||||
if(this.singleSearchFlt) fltcell.colSpan = this.nbCells;
|
||||
if(!this.gridLayout) fltrow.appendChild(fltcell);
|
||||
inpclass = (i==n-1 && this.displayBtn) ? this.fltSmallCssClass : this.fltCssClass;
|
||||
var fltcell = tf_CreateElm(this.fltCellTag),
|
||||
col = this['col'+i],
|
||||
externalFltTgtId =
|
||||
this.isExternalFlt && this.externalFltTgtIds ?
|
||||
this.externalFltTgtIds[i] : null;
|
||||
|
||||
if(this.popUpFilters) this.SetPopupFilter(i);
|
||||
if(this.singleSearchFlt){
|
||||
fltcell.colSpan = this.nbCells;
|
||||
}
|
||||
if(!this.gridLayout){
|
||||
fltrow.appendChild(fltcell);
|
||||
}
|
||||
inpclass = (i==n-1 && this.displayBtn) ?
|
||||
this.fltSmallCssClass : this.fltCssClass;
|
||||
|
||||
if(this['col'+i]==undefined)
|
||||
this['col'+i] = (f['col_'+i]==undefined)
|
||||
? this.fltTypeInp : f['col_'+i].tf_LCase();
|
||||
if(this.popUpFilters){
|
||||
this.SetPopupFilter(i);
|
||||
}
|
||||
|
||||
if(this.singleSearchFlt)
|
||||
{//only 1 input for single search
|
||||
this['col'+i] = this.fltTypeInp;
|
||||
if(col===undefined){
|
||||
col = f['col_'+i]===undefined ?
|
||||
this.fltTypeInp : f['col_'+i].tf_LCase();
|
||||
}
|
||||
|
||||
//only 1 input for single search
|
||||
if(this.singleSearchFlt){
|
||||
col = this.fltTypeInp;
|
||||
inpclass = this.singleFltCssClass;
|
||||
}
|
||||
|
||||
if(this['col'+i]==this.fltTypeSlc || this['col'+i]==this.fltTypeMulti)
|
||||
{//selects
|
||||
//selects
|
||||
if(col===this.fltTypeSlc ||
|
||||
col===this.fltTypeMulti){
|
||||
var slc = tf_CreateElm(this.fltTypeSlc,
|
||||
['id',this.prfxFlt+i+'_'+this.id],
|
||||
['ct',i], ['filled','0']);
|
||||
if(this['col'+i]==this.fltTypeMulti)
|
||||
{
|
||||
|
||||
if(col===this.fltTypeMulti){
|
||||
slc.multiple = this.fltTypeMulti;
|
||||
slc.title = this.multipleSlcTooltip;
|
||||
}
|
||||
slc.className = (this['col'+i].tf_LCase()==this.fltTypeSlc)
|
||||
? inpclass : this.fltMultiCssClass;// for ie<=6
|
||||
slc.className = (col.tf_LCase()===this.fltTypeSlc) ?
|
||||
inpclass : this.fltMultiCssClass;// for ie<=6
|
||||
|
||||
if(this.isExternalFlt && this.externalFltTgtIds && tf_Id(this.externalFltTgtIds[i]))
|
||||
{//filter is appended in desired element
|
||||
tf_Id(this.externalFltTgtIds[i]).appendChild(slc);
|
||||
//filter is appended in desired element
|
||||
if(externalFltTgtId){
|
||||
tf_Id(externalFltTgtId).appendChild(slc);
|
||||
this.externalFltEls.push(slc);
|
||||
} else {
|
||||
fltcell.appendChild(slc);
|
||||
|
@ -1036,15 +1075,18 @@ var TF = (function() {
|
|||
|
||||
this.fltIds.push(this.prfxFlt+i+'_'+this.id);
|
||||
|
||||
if(!this.fillSlcOnDemand) this._PopulateSelect(i);
|
||||
if(!this.fillSlcOnDemand){
|
||||
this._PopulateSelect(i);
|
||||
}
|
||||
|
||||
slc.onkeypress = this.Evt._DetectKey;
|
||||
slc.onchange = this.Evt._OnSlcChange;
|
||||
slc.onfocus = this.Evt._OnSlcFocus;
|
||||
slc.onblur = this.Evt._OnSlcBlur;
|
||||
|
||||
if(this.fillSlcOnDemand)
|
||||
{//1st option is created here since PopulateSelect isn't invoked
|
||||
//1st option is created here since PopulateSelect isn't
|
||||
//invoked
|
||||
if(this.fillSlcOnDemand){
|
||||
var opt0 = tf_CreateOpt(this.displayAllText,'');
|
||||
slc.appendChild(opt0);
|
||||
}
|
||||
|
@ -1056,27 +1098,25 @@ var TF = (function() {
|
|||
select is disabled and by clicking on element
|
||||
(parent td), users enable drop-down and select is
|
||||
populated at same time. */
|
||||
if(this.fillSlcOnDemand && tf_isIE)
|
||||
{
|
||||
if(this.fillSlcOnDemand && tf_isIE){
|
||||
slc.disabled = true;
|
||||
slc.title = this.activateSlcTooltip;
|
||||
slc.parentNode.onclick = this.Evt._EnableSlc;
|
||||
if(this['col'+i]==this.fltTypeMulti)
|
||||
if(col===this.fltTypeMulti){
|
||||
this.__deferMultipleSelection(slc,0);
|
||||
}
|
||||
}
|
||||
|
||||
else if(this['col'+i]==this.fltTypeCheckList)
|
||||
{// checklist
|
||||
}
|
||||
// checklist
|
||||
else if(col===this.fltTypeCheckList){
|
||||
var divCont = tf_CreateElm('div',
|
||||
['id',this.prfxCheckListDiv+i+'_'+this.id],
|
||||
['ct',i],['filled','0']);
|
||||
divCont.className = this.checkListDivCssClass;
|
||||
|
||||
if(this.isExternalFlt && this.externalFltTgtIds
|
||||
&& tf_Id(this.externalFltTgtIds[i]))
|
||||
{//filter is appended in desired element
|
||||
tf_Id(this.externalFltTgtIds[i]).appendChild(divCont);
|
||||
//filter is appended in desired element
|
||||
if(externalFltTgtId){
|
||||
tf_Id(externalFltTgtId).appendChild(divCont);
|
||||
this.externalFltEls.push(divCont);
|
||||
} else {
|
||||
fltcell.appendChild(divCont);
|
||||
|
@ -1084,31 +1124,39 @@ var TF = (function() {
|
|||
|
||||
this.checkListDiv[i] = divCont;
|
||||
this.fltIds.push(this.prfxFlt+i+'_'+this.id);
|
||||
if(!this.fillSlcOnDemand) this._PopulateCheckList(i);
|
||||
if(!this.fillSlcOnDemand){
|
||||
this._PopulateCheckList(i);
|
||||
}
|
||||
|
||||
divCont.onclick = this.Evt._OnCheckListFocus;
|
||||
|
||||
if(this.fillSlcOnDemand)
|
||||
{
|
||||
if(this.fillSlcOnDemand){
|
||||
divCont.onclick = this.Evt._OnCheckListClick;
|
||||
divCont.appendChild(tf_CreateText(this.activateCheckListTxt));
|
||||
divCont.appendChild(
|
||||
tf_CreateText(this.activateCheckListTxt));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
var inptype;
|
||||
(this['col'+i]==this.fltTypeInp) ? inptype='text' : inptype='hidden';//show/hide input
|
||||
var inp = tf_CreateElm(this.fltTypeInp,['id',this.prfxFlt+i+'_'+this.id],['type',inptype],['ct',i]);
|
||||
if(inptype!='hidden')
|
||||
inp.value = (this.isInpWatermarkArray) ? this.inpWatermark[i] : this.inpWatermark;
|
||||
else{
|
||||
//show/hide input
|
||||
var inptype = col===this.fltTypeInp ? 'text' : 'hidden';
|
||||
var inp = tf_CreateElm(this.fltTypeInp,
|
||||
['id',this.prfxFlt+i+'_'+this.id],
|
||||
['type',inptype],['ct',i]);
|
||||
if(inptype!='hidden'){
|
||||
inp.value = (this.isInpWatermarkArray) ?
|
||||
this.inpWatermark[i] : this.inpWatermark;
|
||||
}
|
||||
inp.className = inpclass;// for ie<=6
|
||||
if(this.inpWatermark!='') tf_AddClass(inp, this.inpWatermarkCssClass); //watermark css class
|
||||
if(this.inpWatermark!==''){
|
||||
//watermark css class
|
||||
tf_AddClass(inp, this.inpWatermarkCssClass);
|
||||
}
|
||||
inp.onfocus = this.Evt._OnInpFocus;
|
||||
|
||||
if(this.isExternalFlt && this.externalFltTgtIds && tf_Id(this.externalFltTgtIds[i]))
|
||||
{//filter is appended in desired element
|
||||
tf_Id(this.externalFltTgtIds[i]).appendChild(inp);
|
||||
//filter is appended in desired element
|
||||
if(externalFltTgtId){
|
||||
tf_Id(externalFltTgtId).appendChild(inp);
|
||||
this.externalFltEls.push(inp);
|
||||
} else {
|
||||
fltcell.appendChild(inp);
|
||||
|
@ -1121,27 +1169,30 @@ var TF = (function() {
|
|||
inp.onkeyup = this.Evt._OnKeyUp;
|
||||
inp.onblur = this.Evt._OnInpBlur;
|
||||
|
||||
if(this.rememberGridValues)
|
||||
{
|
||||
var flts = tf_ReadCookie(this.fltsValuesCookie); //reads the cookie
|
||||
if(this.rememberGridValues){
|
||||
//reads the cookie
|
||||
var flts = tf_ReadCookie(this.fltsValuesCookie);
|
||||
var reg = new RegExp(this.separator,'g');
|
||||
var flts_values = flts.split(reg); //creates an array with filters' values
|
||||
if(flts_values[i]!=' ')
|
||||
//creates an array with filters' values
|
||||
var flts_values = flts.split(reg);
|
||||
if(flts_values[i]!=' '){
|
||||
this.SetFilterValue(i,flts_values[i],false);
|
||||
}
|
||||
}
|
||||
|
||||
if(i==n-1 && this.displayBtn)// this adds validation button
|
||||
{
|
||||
var btn = tf_CreateElm(this.fltTypeInp,['id',this.prfxValButton+i+'_'+this.id],
|
||||
}
|
||||
// this adds submit button
|
||||
if(i==n-1 && this.displayBtn){
|
||||
var btn = tf_CreateElm(this.fltTypeInp,
|
||||
['id',this.prfxValButton+i+'_'+this.id],
|
||||
['type','button'], ['value',this.btnText]);
|
||||
btn.className = this.btnCssClass;
|
||||
|
||||
if(this.isExternalFlt && this.externalFltTgtIds && tf_Id(this.externalFltTgtIds[i]))
|
||||
//filter is appended in desired element
|
||||
tf_Id(this.externalFltTgtIds[i]).appendChild(btn);
|
||||
else
|
||||
if(externalFltTgtId){
|
||||
tf_Id(externalFltTgtId).appendChild(btn);
|
||||
} else{
|
||||
fltcell.appendChild(btn);
|
||||
}
|
||||
|
||||
btn.onclick = this.Evt._OnBtnClick;
|
||||
}//if
|
||||
|
@ -1151,40 +1202,57 @@ var TF = (function() {
|
|||
} else {
|
||||
this.__resetGrid();
|
||||
}//if isFirstLoad
|
||||
|
||||
}//if this.fltGrid
|
||||
|
||||
/* Filter behaviours */
|
||||
if(this.rowsCounter) this.SetRowsCounter();
|
||||
if(this.statusBar) this.SetStatusBar();
|
||||
if(this.fixedHeaders && !this.isFirstLoad) this.SetFixedHeaders();
|
||||
if(this.paging) this.SetPaging();
|
||||
if(this.hasResultsPerPage && this.paging) this.SetResultsPerPage();
|
||||
if(this.btnReset) this.SetResetBtn();
|
||||
if(this.helpInstructions) this.SetHelpInstructions();
|
||||
|
||||
if(this.hasColWidth && !this.gridLayout) this.SetColWidths();
|
||||
|
||||
if(this.alternateBgs && this.isStartBgAlternate)
|
||||
this.SetAlternateRows(); //1st time only if no paging and rememberGridValues
|
||||
|
||||
if(this.hasColOperation && this.fltGrid)
|
||||
{
|
||||
if(this.rowsCounter){
|
||||
this.SetRowsCounter();
|
||||
}
|
||||
if(this.statusBar){
|
||||
this.SetStatusBar();
|
||||
}
|
||||
if(this.fixedHeaders && !this.isFirstLoad){
|
||||
this.SetFixedHeaders();
|
||||
}
|
||||
if(this.paging){
|
||||
this.SetPaging();
|
||||
}
|
||||
if(this.hasResultsPerPage && this.paging){
|
||||
this.SetResultsPerPage();
|
||||
}
|
||||
if(this.btnReset){
|
||||
this.SetResetBtn();
|
||||
}
|
||||
if(this.helpInstructions){
|
||||
this.SetHelpInstructions();
|
||||
}
|
||||
if(this.hasColWidth && !this.gridLayout){
|
||||
this.SetColWidths();
|
||||
}
|
||||
if(this.alternateBgs && this.isStartBgAlternate){
|
||||
//1st time only if no paging and rememberGridValues
|
||||
this.SetAlternateRows();
|
||||
}
|
||||
if(this.hasColOperation && this.fltGrid){
|
||||
this.colOperation = f.col_operation;
|
||||
this.SetColOperation();
|
||||
}
|
||||
|
||||
if(this.sort || this.gridLayout) this.SetSort();
|
||||
if(this.selectable || this.editable) this.SetEditable();
|
||||
if(this.sort || this.gridLayout){
|
||||
this.SetSort();
|
||||
}
|
||||
if(this.selectable || this.editable){
|
||||
this.SetEditable();
|
||||
}
|
||||
|
||||
/* Deprecated Loads external script */
|
||||
if(this.hasBindScript)
|
||||
{
|
||||
if(this.bindScript['src']!=undefined)
|
||||
{
|
||||
if(this.hasBindScript) {
|
||||
if(this.bindScript['src']!==undefined){
|
||||
var scriptPath = this.bindScript['src'];
|
||||
var scriptName = (this.bindScript['name']!=undefined)
|
||||
? this.bindScript['name'] : '';
|
||||
this.IncludeFile(scriptName,scriptPath,this.bindScript['target_fn']);
|
||||
var scriptName = this.bindScript['name']!==undefined ?
|
||||
this.bindScript['name'] : '';
|
||||
this.IncludeFile(
|
||||
scriptName,scriptPath,this.bindScript['target_fn']);
|
||||
}
|
||||
}//if bindScript
|
||||
/* */
|
||||
|
@ -1192,48 +1260,61 @@ var TF = (function() {
|
|||
this.isFirstLoad = false;
|
||||
this.hasGrid = true;
|
||||
|
||||
if(this.rememberGridValues || this.rememberPageLen || this.rememberPageNb)
|
||||
if(this.rememberGridValues || this.rememberPageLen ||
|
||||
this.rememberPageNb){
|
||||
this.ResetValues();
|
||||
}
|
||||
|
||||
//TF css class is added to table
|
||||
if(!this.gridLayout) tf_AddClass(this.tbl, this.prfxTf);
|
||||
if(!this.gridLayout){
|
||||
tf_AddClass(this.tbl, this.prfxTf);
|
||||
}
|
||||
|
||||
if(this.loader) this.ShowLoader('none');
|
||||
if(this.loader){
|
||||
this.ShowLoader('none');
|
||||
}
|
||||
|
||||
/* Loads extensions */
|
||||
if(this.hasExtensions) this.LoadExtensions();
|
||||
if(this.hasExtensions){
|
||||
this.LoadExtensions();
|
||||
}
|
||||
|
||||
if(this.onFiltersLoaded)
|
||||
if(this.onFiltersLoaded){
|
||||
this.onFiltersLoaded.call(null,this);
|
||||
}
|
||||
|
||||
},// AddGrid
|
||||
|
||||
EvtManager: function(evt,s)
|
||||
/*====================================================
|
||||
- TF events manager
|
||||
- Params:
|
||||
- event name (string)
|
||||
- config object (optional literal object)
|
||||
=====================================================*/
|
||||
{
|
||||
EvtManager: function(evt, s){
|
||||
var o = this;
|
||||
var slcIndex = (s!=undefined && s.slcIndex!=undefined) ? s.slcIndex : null;
|
||||
var slcExternal = (s!=undefined && s.slcExternal!=undefined) ? s.slcExternal : false;
|
||||
var slcId = (s!=undefined && s.slcId!=undefined) ? s.slcId : null;
|
||||
var pgIndex = (s!=undefined && s.pgIndex!=undefined) ? s.pgIndex : null;
|
||||
var slcIndex = s && s.slcIndex!==undefined ? s.slcIndex : null;
|
||||
var slcExternal = s && s.slcExternal!==undefined ?
|
||||
s.slcExternal : false;
|
||||
var slcId = s && s.slcId!==undefined ? s.slcId : null;
|
||||
var pgIndex = s && s.pgIndex!==undefined ? s.pgIndex : null;
|
||||
|
||||
function efx(){
|
||||
if(evt!=undefined)
|
||||
switch(evt)
|
||||
{
|
||||
if(!evt){ return; }
|
||||
switch(evt){
|
||||
case o.Evt.name.filter:
|
||||
(o.isModFilterFn)
|
||||
? o.modFilterFn.call(null,o)
|
||||
: o._Filter();
|
||||
if(o.isModFilterFn){
|
||||
o.modFilterFn.call(null,o);
|
||||
} else {
|
||||
o._Filter();
|
||||
}
|
||||
break;
|
||||
case o.Evt.name.populateselect:
|
||||
(o.refreshFilters)
|
||||
? o._PopulateSelect(slcIndex,true)
|
||||
: o._PopulateSelect(slcIndex,false,slcExternal,slcId);
|
||||
if(o.refreshFilters){
|
||||
o._PopulateSelect(slcIndex,true);
|
||||
} else {
|
||||
o._PopulateSelect(slcIndex,false,slcExternal,slcId);
|
||||
}
|
||||
break;
|
||||
case o.Evt.name.populatechecklist:
|
||||
o._PopulateCheckList(slcIndex,slcExternal,slcId);
|
||||
|
@ -1271,28 +1352,31 @@ var TF = (function() {
|
|||
o['_'+evt].call(null,o,s);
|
||||
break;
|
||||
}
|
||||
if(o.status || o.statusBar) o.StatusMsg('');
|
||||
if(o.loader) o.ShowLoader('none');
|
||||
if(o.status || o.statusBar){
|
||||
o.StatusMsg('');
|
||||
}
|
||||
if(o.loader){
|
||||
o.ShowLoader('none');
|
||||
}
|
||||
}
|
||||
|
||||
if(this.loader || this.status || this.statusBar)
|
||||
{
|
||||
if(this.loader || this.status || this.statusBar) {
|
||||
try{
|
||||
this.ShowLoader('');
|
||||
this.StatusMsg(o['msg'+evt]);
|
||||
} catch(e){}
|
||||
window.setTimeout(efx,this.execDelay);
|
||||
} else efx();
|
||||
} else {
|
||||
efx();
|
||||
}
|
||||
},
|
||||
|
||||
ImportModule: function(module)
|
||||
{
|
||||
ImportModule: function(module){
|
||||
if(!module.path || !module.name) return;
|
||||
this.IncludeFile(module.name, module.path, module.init);
|
||||
},
|
||||
|
||||
LoadExtensions : function()
|
||||
{
|
||||
LoadExtensions : function(){
|
||||
if(!this.Ext){
|
||||
/*** TF extensions ***/
|
||||
var o = this;
|
||||
|
@ -4143,11 +4227,10 @@ var TF = (function() {
|
|||
}
|
||||
},
|
||||
|
||||
RemoveFixedHeaders: function()
|
||||
/*====================================================
|
||||
- Removes fixed headers
|
||||
=====================================================*/
|
||||
{
|
||||
RemoveFixedHeaders: function(){
|
||||
if(!this.hasGrid || !this.fixedHeaders ) return;
|
||||
if( this.contDiv )//IE additional div
|
||||
{
|
||||
|
@ -5522,9 +5605,6 @@ var TF = (function() {
|
|||
}
|
||||
};
|
||||
|
||||
return TF;
|
||||
})();
|
||||
|
||||
/* --- */
|
||||
|
||||
/*====================================================
|
||||
|
@ -6113,7 +6193,6 @@ function tf_SetOuterHtml(){
|
|||
}
|
||||
/* --- */
|
||||
|
||||
function setFilterGrid(id)
|
||||
/*====================================================
|
||||
- Sets filters grid bar
|
||||
- Calls TF Constructor and generates grid bar
|
||||
|
@ -6124,7 +6203,7 @@ function setFilterGrid(id)
|
|||
object (literal object)
|
||||
- Returns TF object
|
||||
=====================================================*/
|
||||
{
|
||||
function setFilterGrid(id){
|
||||
if(arguments.length === 0){ return; }
|
||||
window['tf_'+id] = new TF(arguments[0], arguments[1], arguments[2]);
|
||||
window['tf_'+id].AddGrid();
|
||||
|
|
Loading…
Reference in a new issue