1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-12 11:27:24 +02:00

Exploring build options requirejs

This commit is contained in:
Max Guglielmi 2015-03-07 22:14:25 +11:00
parent 8b504046b2
commit 2fd0bfd7ff
28 changed files with 8641 additions and 62 deletions

View file

@ -38,9 +38,9 @@ module.exports = function (grunt) {
compile: {
options: {
baseUrl: '<%= source_folder %>',
'paths': {
// 'tf': '.',
'sortabletable': 'extensions/sortabletable'
paths: {
'sortabletable': 'extensions/sortabletable',
'adapterSortabletable': 'extensions/sortabletable/adapterSortabletable'
},
// include: ['../libs/almond/almond', 'tablefilter'],
// exclude: [
@ -60,30 +60,32 @@ module.exports = function (grunt) {
}
},
modules:[
{
name: 'extensions/sortabletable/adapterSortabletable',
include: [
'extensions/sortabletable/adapterSortabletable'
]
},
{
name: 'tablefilter',
//out: '<%= dist_folder %>tablefilter.js',
create: true,
include: [
'../libs/almond/almond',
'tablefilter'
],
exclude: [
'extensions/sortabletable/sortabletable',
excludeShallow: [
'extensions/sortabletable/adapterSortabletable'
]
// ,
// exclude: [
// 'extensions/sortabletable/sortabletable',
// 'extensions/sortabletable/adapterSortabletable'
// ]
}
// {
// name: 'extensions/sortabletable/adapterSortabletable',
// include: [
// 'extensions/sortabletable/sortabletable'
// ]
// }
],
removeCombined: true,
findNestedDependencies: true
/*,
optimize: 'uglify2',
findNestedDependencies: false,
optimize: 'none'/*'uglify2',
preserveLicenseComments: false,
generateSourceMaps: true*/
}
@ -118,8 +120,10 @@ module.exports = function (grunt) {
},
js: {
src: ['<%= dist_folder %>tablefilter.js'],
dest: '<%= dist_folder %>tablefilter.js'
files: [{
src: ['<%= dist_folder %>tablefilter.js'],
dest: '<%= dist_folder %>tablefilter.js'
}]
}
},
@ -139,9 +143,10 @@ module.exports = function (grunt) {
},
copy: {
main: {
tablefilter: {
files: [
{ src: 'libs/sortabletable.js', dest: '<%= source_folder %>/extensions/sortabletable/sortabletable.js' },
{ src: 'libs/sortabletable.js', dest: '<%= source_folder %>extensions/sortabletable/sortabletable.js' },
{ src: 'libs/requirejs/require.js', dest: '<%= dist_folder %>require.js' },
// { src: ['**'], cwd: '<%= source_folder %>TF_Modules/', dest: '<%= dist_folder %>TF_Modules/', expand: true },
{ src: ['**'], cwd: '<%= source_folder %>TF_Themes/', dest: '<%= dist_folder %>TF_Themes/', expand: true }
]
@ -178,8 +183,9 @@ module.exports = function (grunt) {
// This is the default task being executed if Grunt
// is called without any further parameter.
grunt.registerTask('default', ['jshint', 'babel', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'qunit']);
grunt.registerTask('build', ['jshint', 'babel', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy']);
grunt.registerTask('build', ['jshint', 'babel', 'requirejs', 'concat', /*'uglify',*/ 'cssmin', 'copy']);
grunt.registerTask('dev', ['jshint', 'babel', 'concat', 'cssmin', 'copy']);
grunt.registerTask('build-requirejs', ['requirejs']);
grunt.registerTask('toes5', ['babel']);
grunt.registerTask('test', ['qunit']);
};

File diff suppressed because one or more lines are too long

View file

@ -1 +1,71 @@
TF.prototype.SetRowBg=function(e,t){if(!this.alternateBgs||isNaN(e))return;var n=this.tbl.rows,r=t==undefined?e:t;this.RemoveRowBg(e),tf_AddClass(n[e],r%2?this.rowBgEvenCssClass:this.rowBgOddCssClass)},TF.prototype.RemoveRowBg=function(e){if(isNaN(e))return;var t=this.tbl.rows;tf_RemoveClass(t[e],this.rowBgOddCssClass),tf_RemoveClass(t[e],this.rowBgEvenCssClass)},TF.prototype.SetAlternateRows=function(){if(!this.hasGrid&&!this.isFirstLoad)return;var e=this.tbl.rows,t=this.validRowsIndex==null,n=t?this.refRow:0,r=t?this.nbFilterableRows+n:this.validRowsIndex.length,i=0;for(var s=n;s<r;s++){var o=t?s:this.validRowsIndex[s];this.SetRowBg(o,i),i++}},TF.prototype.RemoveAlternateRows=function(){if(!this.hasGrid)return;var e=this.tbl.rows;for(var t=this.refRow;t<this.nbRows;t++)this.RemoveRowBg(t);this.isStartBgAlternate=!0};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Alternating rows color feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetRowBg = function(rIndex,index)
/*====================================================
- sets row background color
- Params:
- rIndex: row index (numeric value)
- index: valid row collection index needed to
calculate bg color
=====================================================*/
{
if(!this.alternateBgs || isNaN(rIndex)) return;
var rows = this.tbl.rows;
var i = (index==undefined) ? rIndex : index;
this.RemoveRowBg(rIndex);
tf_AddClass(
rows[rIndex],
(i%2) ? this.rowBgEvenCssClass : this.rowBgOddCssClass
);
}
TF.prototype.RemoveRowBg = function(index)
/*====================================================
- removes row background color
- Params:
- index: row index (numeric value)
=====================================================*/
{
if(isNaN(index)) return;
var rows = this.tbl.rows;
tf_RemoveClass(rows[index],this.rowBgOddCssClass);
tf_RemoveClass(rows[index],this.rowBgEvenCssClass);
}
TF.prototype.SetAlternateRows = function()
/*====================================================
- alternates row colors for better readability
=====================================================*/
{
if( !this.hasGrid && !this.isFirstLoad ) return;
var rows = this.tbl.rows;
var noValidRowsIndex = this.validRowsIndex==null;
var beginIndex = (noValidRowsIndex) ? this.refRow : 0; //1st index
var indexLen = (noValidRowsIndex) // nb indexes
? (this.nbFilterableRows+beginIndex) : this.validRowsIndex.length;
var idx = 0;
for(var j=beginIndex; j<indexLen; j++)//alternates bg color
{
var rIndex = (noValidRowsIndex) ? j : this.validRowsIndex[j];
this.SetRowBg(rIndex,idx);
idx++;
}
}
TF.prototype.RemoveAlternateRows = function()
/*====================================================
- removes alternate row colors
=====================================================*/
{
if(!this.hasGrid) return;
var row = this.tbl.rows;
for(var i=this.refRow; i<this.nbRows; i++)
this.RemoveRowBg(i);
this.isStartBgAlternate = true;
}

View file

@ -1 +1,271 @@
TF.prototype.SetColOperation=function(){if(!this.isFirstLoad&&!this.hasGrid)return;this.onBeforeOperation&&this.onBeforeOperation.call(null,this);var labelId=this.colOperation.id,colIndex=this.colOperation.col,operation=this.colOperation.operation,outputType=this.colOperation.write_method,totRowIndex=this.colOperation.tot_row_index,excludeRow=this.colOperation.exclude_row,decimalPrecision=this.colOperation["decimal_precision"]!=undefined?this.colOperation.decimal_precision:2,ucolIndex=[],ucolMax=0;ucolIndex[ucolMax]=colIndex[0];for(var i=1;i<colIndex.length;i++){saved=0;for(var j=0;j<=ucolMax;j++)ucolIndex[j]==colIndex[i]&&(saved=1);saved==0&&(ucolMax++,ucolIndex[ucolMax]=colIndex[i])}if((typeof labelId).tf_LCase()=="object"&&(typeof colIndex).tf_LCase()=="object"&&(typeof operation).tf_LCase()=="object"){var row=this.tbl.rows,colvalues=[];for(var ucol=0;ucol<=ucolMax;ucol++){colvalues.push(this.GetColValues(ucolIndex[ucol],!0,excludeRow));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;for(var i=0;i<colIndex.length;i++)if(colIndex[i]==ucolIndex[ucol]){mThisCol++,opsThisCol[mThisCol]=operation[i].tf_LCase(),decThisCol[mThisCol]=decimalPrecision[i],labThisCol[mThisCol]=labelId[i],oTypeThisCol=outputType!=undefined&&(typeof outputType).tf_LCase()=="object"?outputType[i]:null;switch(opsThisCol[mThisCol]){case"mean":meanFlag=1;break;case"sum":sumFlag=1;break;case"min":minFlag=1;break;case"max":maxFlag=1;break;case"median":medFlag=1;break;case"q1":q1Flag=1;break;case"q3":q3Flag=1}}for(var j=0;j<colvalues[ucol].length;j++){if(q1Flag==1||q3Flag==1||medFlag==1)if(j<colvalues[ucol].length-1)for(k=j+1;k<colvalues[ucol].length;k++)eval(colvalues[ucol][k])<eval(colvalues[ucol][j])&&(temp=colvalues[ucol][j],colvalues[ucol][j]=colvalues[ucol][k],colvalues[ucol][k]=temp);var cvalue=parseFloat(colvalues[ucol][j]);theList[j]=parseFloat(cvalue);if(!isNaN(cvalue)){nbvalues++;if(sumFlag==1||meanFlag==1)sumValue+=parseFloat(cvalue);minFlag==1&&(minValue==null?minValue=parseFloat(cvalue):minValue=parseFloat(cvalue)<minValue?parseFloat(cvalue):minValue),maxFlag==1&&(maxValue==null?maxValue=parseFloat(cvalue):maxValue=parseFloat(cvalue)>maxValue?parseFloat(cvalue):maxValue)}}meanFlag==1&&(meanValue=sumValue/nbvalues);if(medFlag==1){var aux=0;nbvalues%2==1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}if(q1Flag==1){var posa=0;posa=Math.floor(nbvalues/4),4*posa==nbvalues?q1Value=(theList[posa-1]+theList[posa])/2:q1Value=theList[posa]}if(q3Flag==1){var posa=0,posb=0;posa=Math.floor(nbvalues/4),4*posa==nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;i<=mThisCol;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=decThisCol[i]!=undefined&&!isNaN(decThisCol[i])?decThisCol[i]:2;if(oTypeThisCol!=null&&result){result=result.toFixed(precision);if(tf_Id(labThisCol[i])!=undefined)switch(oTypeThisCol.tf_LCase()){case"innerhtml":isNaN(result)||!isFinite(result)||nbvalues==0?tf_Id(labThisCol[i]).innerHTML=".":tf_Id(labThisCol[i]).innerHTML=result;break;case"setvalue":tf_Id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=tf_Id(labThisCol[i]).firstChild,txtnode=tf_CreateText(result);tf_Id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||nbvalues==0?tf_Id(labThisCol[i]).innerHTML=".":tf_Id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}totRowIndex!=undefined&&row[totRowIndex[ucol]]&&(row[totRowIndex[ucol]].style.display="")}}this.onAfterOperation&&this.onAfterOperation.call(null,this)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Columns Operations feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
- Special credit to Nuovella Williams
-------------------------------------------------------------------------*/
TF.prototype.SetColOperation = function()
/*====================================================
- Calculates values of a column
- params are stored in 'colOperation' table's
attribute
- colOperation['id'] contains ids of elements
showing result (array)
- colOperation['col'] contains index of
columns (array)
- colOperation['operation'] contains operation
type (array, values: sum, mean)
- colOperation['write_method'] array defines
which method to use for displaying the
result (innerHTML, setValue, createTextNode).
Note that innerHTML is the default value.
- colOperation['tot_row_index'] defines in
which row results are displayed (integers array)
- changes made by nuovella:
(1) optimized the routine (now it will only
process each column once),
(2) added calculations for the median, lower and
upper quartile.
=====================================================*/
{
if( !this.isFirstLoad && !this.hasGrid ) return;
if(this.onBeforeOperation) this.onBeforeOperation.call(null,this);
var labelId = this.colOperation['id'];
var colIndex = this.colOperation['col'];
var operation = this.colOperation['operation'];
var outputType = this.colOperation['write_method'];
var totRowIndex = this.colOperation['tot_row_index'];
var excludeRow = this.colOperation['exclude_row'];
var decimalPrecision = this.colOperation['decimal_precision']!=undefined
? this.colOperation['decimal_precision'] : 2;
//nuovella: determine unique list of columns to operate on
var ucolIndex =[];
var ucolMax=0;
ucolIndex[ucolMax]=colIndex[0];
for(var i=1; i<colIndex.length; i++)
{
saved=0;
//see if colIndex[i] is already in the list of unique indexes
for(var j=0; j<=ucolMax; j++ )
{
if (ucolIndex[j]==colIndex[i])
saved=1;
}
if (saved==0)
{//if not saved then, save the index;
ucolMax++;
ucolIndex[ucolMax]=colIndex[i];
}
}// for i
if( (typeof labelId).tf_LCase()=='object'
&& (typeof colIndex).tf_LCase()=='object'
&& (typeof operation).tf_LCase()=='object' )
{
var row = this.tbl.rows;
var colvalues = [];
for(var ucol=0; ucol<=ucolMax; ucol++)
{
//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.GetColValues(ucolIndex[ucol],true,excludeRow) );
//next: calculate all operations for this column
var result, nbvalues=0, temp;
var meanValue=0, sumValue=0, minValue=null, maxValue=null, q1Value=null, medValue=null, q3Value=null;
var meanFlag=0, sumFlag=0, minFlag=0, maxFlag=0, q1Flag=0, medFlag=0, q3Flag=0;
var theList=[];
var opsThisCol=[], decThisCol=[], labThisCol=[], oTypeThisCol=[];
var mThisCol=-1;
for(var i=0; i<colIndex.length; i++)
{
if (colIndex[i]==ucolIndex[ucol])
{
mThisCol++;
opsThisCol[mThisCol]=operation[i].tf_LCase();
decThisCol[mThisCol]=decimalPrecision[i];
labThisCol[mThisCol]=labelId[i];
oTypeThisCol = (outputType != undefined && (typeof outputType).tf_LCase()=='object')
? outputType[i] : null;
switch( opsThisCol[mThisCol] )
{
case 'mean':
meanFlag=1;
break;
case 'sum':
sumFlag=1;
break;
case 'min':
minFlag=1;
break;
case 'max':
maxFlag=1;
break;
case 'median':
medFlag=1;
break;
case 'q1':
q1Flag=1;
break;
case 'q3':
q3Flag=1;
break;
}
}
}
for(var j=0; j<colvalues[ucol].length; j++ )
{
if ((q1Flag==1)||(q3Flag==1) || (medFlag==1))
{//sort the list for calculation of median and quartiles
if (j<colvalues[ucol].length -1)
{
for(k=j+1;k<colvalues[ucol].length; k++) {
if( eval(colvalues[ucol][k]) < eval(colvalues[ucol][j]))
{
temp = colvalues[ucol][j];
colvalues[ucol][j] = colvalues[ucol][k];
colvalues[ucol][k] = temp;
}
}
}
}
var cvalue = parseFloat(colvalues[ucol][j]);
theList[j]=parseFloat( cvalue );
if( !isNaN(cvalue) )
{
nbvalues++;
if ((sumFlag==1)|| (meanFlag==1)) sumValue += parseFloat( cvalue );
if (minFlag==1)
{
if (minValue==null)
{
minValue = parseFloat( cvalue );
}
else minValue= parseFloat( cvalue )<minValue? parseFloat( cvalue ): minValue;
}
if (maxFlag==1) {
if (maxValue==null)
{maxValue = parseFloat( cvalue );}
else {maxValue= parseFloat( cvalue )>maxValue? parseFloat( cvalue ): maxValue;}
}
}
}//for j
if (meanFlag==1) meanValue = sumValue/nbvalues;
if (medFlag==1)
{
var aux = 0;
if(nbvalues%2 == 1)
{
aux = Math.floor(nbvalues/2);
medValue = theList[aux];
}
else medValue = (theList[nbvalues/2]+theList[((nbvalues/2)-1)])/2;
}
if (q1Flag==1)
{
var posa=0.0;
posa = Math.floor(nbvalues/4);
if (4*posa == nbvalues) {q1Value = (theList[posa-1] + theList[posa])/2;}
else {q1Value = theList[posa];}
}
if (q3Flag==1)
{
var posa=0.0;
var posb=0.0;
posa = Math.floor(nbvalues/4);
if (4*posa == nbvalues)
{
posb = 3*posa;
q3Value = (theList[posb] + theList[posb-1])/2;
}
else
q3Value = theList[nbvalues-posa-1];
}
for(var i=0; i<=mThisCol; i++ )
{
switch( opsThisCol[i] )
{
case 'mean':
result=meanValue;
break;
case 'sum':
result=sumValue;
break;
case 'min':
result=minValue;
break;
case 'max':
result=maxValue;
break;
case 'median':
result=medValue;
break;
case 'q1':
result=q1Value;
break;
case 'q3':
result=q3Value;
break;
}
var precision = decThisCol[i]!=undefined && !isNaN( decThisCol[i] )
? decThisCol[i] : 2;
if(oTypeThisCol!=null && result)
{//if outputType is defined
result = result.toFixed( precision );
if( tf_Id( labThisCol[i] )!=undefined )
{
switch( oTypeThisCol.tf_LCase() )
{
case 'innerhtml':
if (isNaN(result) || !isFinite(result) || (nbvalues==0))
tf_Id( labThisCol[i] ).innerHTML = '.';
else
tf_Id( labThisCol[i] ).innerHTML = result;
break;
case 'setvalue':
tf_Id( labThisCol[i] ).value = result;
break;
case 'createtextnode':
var oldnode = tf_Id( labThisCol[i] ).firstChild;
var txtnode = tf_CreateText( result );
tf_Id( labThisCol[i] ).replaceChild( txtnode,oldnode );
break;
}//switch
}
} else {
try
{
if (isNaN(result) || !isFinite(result) || (nbvalues==0))
tf_Id( labThisCol[i] ).innerHTML = '.';
else
tf_Id( labThisCol[i] ).innerHTML = result.toFixed( precision );
} catch(e){ }//catch
}//else
}//for i
//eventual row(s) with result are always visible
if(totRowIndex!=undefined && row[totRowIndex[ucol]])
row[totRowIndex[ucol]].style.display = '';
}//for ucol
}//if typeof
if(this.onAfterOperation) this.onAfterOperation.call(null,this);
}

View file

@ -1 +1,163 @@
TF.prototype.RememberFiltersValue=function(e){var t=[];for(var n=0;n<this.fltIds.length;n++)value=this.GetFilterValue(n),value==""&&(value=" "),t.push(value);t.push(this.fltIds.length),tf_WriteCookie(e,t.join(this.separator),this.cookieDuration)},TF.prototype.RememberPageNb=function(e){tf_WriteCookie(e,this.currentPageNb,this.cookieDuration)},TF.prototype.RememberPageLength=function(e){tf_WriteCookie(e,this.resultsPerPageSlc.selectedIndex,this.cookieDuration)},TF.prototype.ResetValues=function(){this.EvtManager(this.Evt.name.resetvalues)},TF.prototype._ResetValues=function(){this.rememberGridValues&&this.fillSlcOnDemand&&this.ResetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.ResetPageLength(this.pgLenCookie),this.rememberPageNb&&this.ResetPage(this.pgNbCookie)},TF.prototype.ResetGridValues=function(e){if(!this.fillSlcOnDemand)return;var t=tf_ReadCookie(e),n=new RegExp(this.separator,"g"),r=t.split(n),i=this.GetFiltersByType(this.fltTypeSlc,!0),s=this.GetFiltersByType(this.fltTypeMulti,!0);if(r[r.length-1]==this.fltIds.length){for(var o=0;o<r.length-1;o++){if(r[o]==" ")continue;if(this["col"+o]==this.fltTypeSlc||this["col"+o]==this.fltTypeMulti){var u=tf_Id(this.fltIds[o]);u.options[0].selected=!1;if(i.tf_Has(o)){var a=tf_CreateOpt(r[o],r[o],!0);u.appendChild(a),this.hasStoredValues=!0}if(s.tf_Has(o)){var f=r[o].split(" "+this.orOperator+" ");for(j=0;j<f.length;j++){if(f[j]=="")continue;var a=tf_CreateOpt(f[j],f[j],!0);u.appendChild(a),this.hasStoredValues=!0,tf_isIE&&(this.__deferMultipleSelection(u,j,!1),hasStoredValues=!1)}}}else if(this["col"+o]==this.fltTypeCheckList){var l=this.checkListDiv[o];l.title=l.innerHTML,l.innerHTML="";var c=tf_CreateElm("ul",["id",this.fltIds[o]],["colIndex",o]);c.className=this.checkListCssClass;var h=tf_CreateCheckItem(this.fltIds[o]+"_0","",this.displayAllText);h.className=this.checkListItemCssClass,c.appendChild(h),l.appendChild(c);var f=r[o].split(" "+this.orOperator+" ");for(j=0;j<f.length;j++){if(f[j]=="")continue;var p=tf_CreateCheckItem(this.fltIds[o]+"_"+(j+1),f[j],f[j]);p.className=this.checkListItemCssClass,c.appendChild(p),p.check.checked=!0,this.__setCheckListValues(p.check),this.hasStoredValues=!0}}}!this.hasStoredValues&&this.paging&&this.SetPagingInfo()}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Remember values features (cookies) v1.1
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.RememberFiltersValue = function( name )
/*==============================================
- stores filters' values in a cookie
when Filter() method is called
- Params:
- name: cookie name (string)
- credits to Florent Hirchy
===============================================*/
{
var flt_values = [];
for(var i=0; i<this.fltIds.length; i++)
{//creates an array with filters' values
value = this.GetFilterValue(i);
if (value == '') value = ' ';
flt_values.push(value);
}
flt_values.push(this.fltIds.length); //adds array size
tf_WriteCookie(
name,
flt_values.join(this.separator),
this.cookieDuration
); //writes cookie
}
TF.prototype.RememberPageNb = function( name )
/*==============================================
- stores page number value in a cookie
when ChangePage method is called
- Params:
- name: cookie name (string)
===============================================*/
{
tf_WriteCookie(
name,
this.currentPageNb,
this.cookieDuration
); //writes cookie
}
TF.prototype.RememberPageLength = function( name )
/*==============================================
- stores page length value in a cookie
when ChangePageLength method is called
- Params:
- name: cookie name (string)
===============================================*/
{
tf_WriteCookie(
name,
this.resultsPerPageSlc.selectedIndex,
this.cookieDuration
); //writes cookie
}
TF.prototype.ResetValues = function()
{
this.EvtManager(this.Evt.name.resetvalues);
}
TF.prototype._ResetValues = function()
/*==============================================
- re-sets grid values when page is
re-loaded. It invokes ResetGridValues,
ResetPage and ResetPageLength methods
- Params:
- name: cookie name (string)
===============================================*/
{
if(this.rememberGridValues && this.fillSlcOnDemand) //only fillSlcOnDemand
this.ResetGridValues(this.fltsValuesCookie);
if(this.rememberPageLen) this.ResetPageLength( this.pgLenCookie );
if(this.rememberPageNb) this.ResetPage( this.pgNbCookie );
}
TF.prototype.ResetGridValues = function( name )
/*==============================================
- re-sets filters' values when page is
re-loaded if load on demand is enabled
- Params:
- name: cookie name (string)
- credits to Florent Hirchy
===============================================*/
{
if(!this.fillSlcOnDemand) return;
var flts = tf_ReadCookie(name); //reads the cookie
var reg = new RegExp(this.separator,'g');
var flts_values = flts.split(reg); //creates an array with filters' values
var slcFltsIndex = this.GetFiltersByType(this.fltTypeSlc, true);
var multiFltsIndex = this.GetFiltersByType(this.fltTypeMulti, true);
if(flts_values[(flts_values.length-1)] == this.fltIds.length)
{//if the number of columns is the same as before page reload
for(var i=0; i<(flts_values.length - 1); i++)
{
if (flts_values[i]==' ') continue;
if(this['col'+i]==this.fltTypeSlc || this['col'+i]==this.fltTypeMulti)
{// if fillSlcOnDemand, drop-down needs to contain stored value(s) for filtering
var slc = tf_Id( this.fltIds[i] );
slc.options[0].selected = false;
if( slcFltsIndex.tf_Has(i) )
{//selects
var opt = tf_CreateOpt(flts_values[i],flts_values[i],true);
slc.appendChild(opt);
this.hasStoredValues = true;
}
if(multiFltsIndex.tf_Has(i))
{//multiple select
var s = flts_values[i].split(' '+this.orOperator+' ');
for(j=0; j<s.length; j++)
{
if(s[j]=='') continue;
var opt = tf_CreateOpt(s[j],s[j],true);
slc.appendChild(opt);
this.hasStoredValues = true;
if(tf_isIE)
{// IE multiple selection work-around
this.__deferMultipleSelection(slc,j,false);
hasStoredValues = false;
}
}
}// if multiFltsIndex
}
else if(this['col'+i]==this.fltTypeCheckList)
{
var divChk = this.checkListDiv[i];
divChk.title = divChk.innerHTML;
divChk.innerHTML = '';
var ul = tf_CreateElm('ul',['id',this.fltIds[i]],['colIndex',i]);
ul.className = this.checkListCssClass;
var li0 = tf_CreateCheckItem(this.fltIds[i]+'_0', '', this.displayAllText);
li0.className = this.checkListItemCssClass;
ul.appendChild(li0);
divChk.appendChild(ul);
var s = flts_values[i].split(' '+this.orOperator+' ');
for(j=0; j<s.length; j++)
{
if(s[j]=='') continue;
var li = tf_CreateCheckItem(this.fltIds[i]+'_'+(j+1), s[j], s[j]);
li.className = this.checkListItemCssClass;
ul.appendChild(li);
li.check.checked = true;
this.__setCheckListValues(li.check);
this.hasStoredValues = true;
}
}
}//end for
if(!this.hasStoredValues && this.paging) this.SetPagingInfo();
}//end if
}

View file

@ -1 +1,53 @@
TF.prototype.LoadExtensions=function(){if(!this.Ext){var e=this;this.Ext={list:{},add:function(t,n,r,i){var s=r.split("/")[r.split("/").length-1],u=new RegExp(s),a=r.replace(u,"");e.Ext.list[t]={name:t,description:n,file:s,path:a,callback:i}}}}this.EvtManager(this.Evt.name.loadextensions)},TF.prototype._LoadExtensions=function(){if(!this.hasExtensions)return;if(tf_IsArray(this.extensions.name)&&tf_IsArray(this.extensions.src)){var e=this.extensions;for(var t=0;t<e.name.length;t++){var n=e.src[t],r=e.name[t],i=e.initialize&&e.initialize[t]?e.initialize[t]:null,s=e.description&&e.description[t]?e.description[t]:null;this.Ext.add(r,s,n,i),tf_IsImported(n)?i.call(null,this):this.IncludeFile(r,n,i)}}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Extensions loading feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.LoadExtensions = function()
{
if(!this.Ext){
/*** TF extensions ***/
var o = this;
this.Ext = {
list: {},
add: function(extName, extDesc, extPath, extCallBack)
{
var file = extPath.split('/')[extPath.split('/').length-1];
var re = new RegExp(file);
var path = extPath.replace(re,'');
o.Ext.list[extName] = {
name: extName,
description: extDesc,
file: file,
path: path,
callback: extCallBack
};
}
};
}
this.EvtManager(this.Evt.name.loadextensions);
}
TF.prototype._LoadExtensions = function()
/*====================================================
- loads TF extensions
=====================================================*/
{
if(!this.hasExtensions) return;
if(tf_IsArray(this.extensions.name) && tf_IsArray(this.extensions.src)){
var ext = this.extensions;
for(var e=0; e<ext.name.length; e++){
var extPath = ext.src[e];
var extName = ext.name[e];
var extInit = (ext.initialize && ext.initialize[e]) ? ext.initialize[e] : null;
var extDesc = (ext.description && ext.description[e] ) ? ext.description[e] : null;
//Registers extension
this.Ext.add(extName, extDesc, extPath, extInit);
if(tf_IsImported(extPath)) extInit.call(null,this);
else this.IncludeFile(extName, extPath, extInit);
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -1 +1,95 @@
TF.prototype.SetFixedHeaders=function(){if(!this.hasGrid&&!this.isFirstLoad||!this.fixedHeaders)return;if(this.contDiv)return;var e=tf_Tag(this.tbl,"thead");if(e.length==0)return;var t=tf_Tag(this.tbl,"tbody");if(t[0].clientHeight!=0)this.prevTBodyH=t[0].clientHeight,this.prevTBodyOverflow=t[0].style.overflow,this.prevTBodyOverflowX=t[0].style.overflowX,t[0].style.height=this.tBodyH+"px",t[0].style.overflow="auto",t[0].style.overflowX="hidden";else{var n=tf_CreateElm("div",["id",this.prfxContentDiv+this.id]);n.className=this.contDivCssClass,this.tbl.parentNode.insertBefore(n,this.tbl),n.appendChild(this.tbl),this.contDiv=tf_Id(this.prfxContentDiv+this.id),this.contDiv.style.position="relative";var r=0,i=tf_Tag(e[0],"tr");for(var s=0;s<i.length;s++)i[s].style.cssText+="position:relative; top:expression(offsetParent.scrollTop);",r+=parseInt(i[s].clientHeight);this.contDiv.style.height=this.tBodyH+r+"px";var o=tf_Tag(this.tbl,"tfoot");if(o.length==0)return;var u=tf_Tag(o[0],"tr");for(var a=0;a<u.length;a++)u[a].style.cssText+="position:relative; overflow-x: hidden; top: expression(parentNode.parentNode.offsetHeight >= offsetParent.offsetHeight ? 0 - parentNode.parentNode.offsetHeight + offsetParent.offsetHeight + offsetParent.scrollTop : 0);"}},TF.prototype.RemoveFixedHeaders=function(){if(!this.hasGrid||!this.fixedHeaders)return;if(this.contDiv){this.contDiv.parentNode.insertBefore(this.tbl,this.contDiv),this.contDiv.parentNode.removeChild(this.contDiv),this.contDiv=null;var e=tf_Tag(this.tbl,"thead");if(e.length==0)return;var t=tf_Tag(e[0],"tr");if(t.length==0)return;for(var n=0;n<t.length;n++)t[n].style.cssText="";var r=tf_Tag(this.tbl,"tfoot");if(r.length==0)return;var i=tf_Tag(r[0],"tr");for(var s=0;s<i.length;s++)i[s].style.position="relative",i[s].style.top="",i[s].style.overeflowX=""}else{var o=tf_Tag(this.tbl,"tbody");if(o.length==0)return;o[0].style.height=this.prevTBodyH+"px",o[0].style.overflow=this.prevTBodyOverflow,o[0].style.overflowX=this.prevTBodyOverflowX}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Fixed headers feature v1.0 - Deprecated!
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetFixedHeaders = function()
/*====================================================
- CSS solution making headers fixed
=====================================================*/
{
if((!this.hasGrid && !this.isFirstLoad) || !this.fixedHeaders) return;
if(this.contDiv) return;
var thead = tf_Tag(this.tbl,'thead');
if( thead.length==0 ) return;
var tbody = tf_Tag(this.tbl,'tbody');
if( tbody[0].clientHeight!=0 )
{//firefox returns tbody height
//previous values
this.prevTBodyH = tbody[0].clientHeight;
this.prevTBodyOverflow = tbody[0].style.overflow;
this.prevTBodyOverflowX = tbody[0].style.overflowX;
tbody[0].style.height = this.tBodyH+'px';
tbody[0].style.overflow = 'auto';
tbody[0].style.overflowX = 'hidden';
} else { //IE returns 0
// cont div is added to emulate fixed headers behaviour
var contDiv = tf_CreateElm( 'div',['id',this.prfxContentDiv+this.id] );
contDiv.className = this.contDivCssClass;
this.tbl.parentNode.insertBefore(contDiv, this.tbl);
contDiv.appendChild(this.tbl);
this.contDiv = tf_Id(this.prfxContentDiv+this.id);
//prevents headers moving during window scroll (IE)
this.contDiv.style.position = 'relative';
var theadH = 0;
var theadTr = tf_Tag(thead[0],'tr');
for(var i=0; i<theadTr.length; i++)
{//css below emulates fixed headers on IE<=6
theadTr[i].style.cssText += 'position:relative; ' +
'top:expression(offsetParent.scrollTop);';
theadH += parseInt(theadTr[i].clientHeight);
}
this.contDiv.style.height = (this.tBodyH+theadH)+'px';
var tfoot = tf_Tag(this.tbl,'tfoot');
if( tfoot.length==0 ) return;
var tfootTr = tf_Tag(tfoot[0],'tr');
for(var j=0; j<tfootTr.length; j++)//css below emulates fixed footer on IE<=6
tfootTr[j].style.cssText += 'position:relative; overflow-x: hidden; ' +
'top: expression(parentNode.parentNode.offsetHeight >= ' +
'offsetParent.offsetHeight ? 0 - parentNode.parentNode.offsetHeight + '+
'offsetParent.offsetHeight + offsetParent.scrollTop : 0);';
}
}
TF.prototype.RemoveFixedHeaders = function()
/*====================================================
- Removes fixed headers
=====================================================*/
{
if(!this.hasGrid || !this.fixedHeaders ) return;
if( this.contDiv )//IE additional div
{
this.contDiv.parentNode.insertBefore(this.tbl, this.contDiv);
this.contDiv.parentNode.removeChild( this.contDiv );
this.contDiv = null;
var thead = tf_Tag(this.tbl,'thead');
if( thead.length==0 ) return;
var theadTr = tf_Tag(thead[0],'tr');
if( theadTr.length==0 ) return;
for(var i=0; i<theadTr.length; i++)
theadTr[i].style.cssText = '';
var tfoot = tf_Tag(this.tbl,'tfoot');
if( tfoot.length==0 ) return;
var tfootTr = tf_Tag(tfoot[0],'tr');
for(var j=0; j<tfootTr.length; j++)
{
tfootTr[j].style.position = 'relative';
tfootTr[j].style.top = '';
tfootTr[j].style.overeflowX = '';
}
} else {
var tbody = tf_Tag(this.tbl,'tbody');
if( tbody.length==0 ) return;
tbody[0].style.height = this.prevTBodyH+'px';
tbody[0].style.overflow = this.prevTBodyOverflow;
tbody[0].style.overflowX = this.prevTBodyOverflowX;
}
}

File diff suppressed because one or more lines are too long

View file

@ -1 +1,97 @@
function tf_HighlightWord(e,t,n,r){if(e.hasChildNodes)for(var i=0;i<e.childNodes.length;i++)tf_HighlightWord(e.childNodes[i],t,n,r);if(e.nodeType==3){var s=e.nodeValue.tf_LCase(),o=t.tf_LCase();if(s.indexOf(o)!=-1){var u=e.parentNode;if(u&&u.className!=n){var a=e.nodeValue,f=s.indexOf(o),l=tf_CreateText(a.substr(0,f)),c=a.substr(f,t.length),h=tf_CreateText(a.substr(f+t.length)),p=tf_CreateText(c),d=tf_CreateElm("span");d.className=n,d.appendChild(p),u.insertBefore(l,e),u.insertBefore(d,e),u.insertBefore(h,e),u.removeChild(e),r.highlightedNodes.push(d.firstChild)}}}}function tf_UnhighlightWord(e,t,n){var r=[];for(var i=0;i<e.highlightedNodes.length;i++){var s=e.highlightedNodes[i];if(!s)continue;var o=s.nodeValue.tf_LCase(),u=t.tf_LCase();if(o.indexOf(u)!=-1){var a=s.parentNode;if(a&&a.className==n){var f=a.previousSibling,l=a.nextSibling;if(!f||!l)continue;l.nodeValue=f.nodeValue+s.nodeValue+l.nodeValue,f.nodeValue="",s.nodeValue="",r.push(i)}}}for(var c=0;c<r.length;c++)e.highlightedNodes.splice(r[c],1)}TF.prototype.UnhighlightAll=function(){if(this.highlightKeywords&&this.searchArgs!=null){for(var e=0;e<this.searchArgs.length;e++)tf_UnhighlightWord(this,this.searchArgs[e],this.highlightCssClass);this.highlightedNodes=[]}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Highlight keywords feature v1.2
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.UnhighlightAll = function()
/*====================================================
- removes keyword highlighting
=====================================================*/
{
if( this.highlightKeywords && this.searchArgs!=null ){
for(var y=0; y<this.searchArgs.length; y++){
tf_UnhighlightWord(this, this.searchArgs[y], this.highlightCssClass);
}
this.highlightedNodes = [];
}
}
function tf_HighlightWord( node,word,cssClass,o )
/*====================================================
- highlights keyword found in passed node
- accepts the following params:
- node
- word to search
- css class name for highlighting
=====================================================*/
{
// Iterate into this nodes childNodes
if(node.hasChildNodes)
for( var i=0; i<node.childNodes.length; i++ )
tf_HighlightWord(node.childNodes[i],word,cssClass,o);
// And do this node itself
if(node.nodeType == 3)
{ // text node
var tempNodeVal = node.nodeValue.tf_LCase();
var tempWordVal = word.tf_LCase();
if(tempNodeVal.indexOf(tempWordVal) != -1)
{
var pn = node.parentNode;
if(pn && pn.className != cssClass)
{
// word has not already been highlighted!
var nv = node.nodeValue;
var ni = tempNodeVal.indexOf(tempWordVal);
// Create a load of replacement nodes
var before = tf_CreateText(nv.substr(0,ni));
var docWordVal = nv.substr(ni,word.length);
var after = tf_CreateText(nv.substr(ni+word.length));
var hiwordtext = tf_CreateText(docWordVal);
var hiword = tf_CreateElm('span');
hiword.className = cssClass;
hiword.appendChild(hiwordtext);
pn.insertBefore(before,node);
pn.insertBefore(hiword,node);
pn.insertBefore(after,node);
pn.removeChild(node);
o.highlightedNodes.push(hiword.firstChild);
}
}
}// if node.nodeType == 3
}
function tf_UnhighlightWord( o,word,cssClass )
/*====================================================
- removes highlights found in passed node
- accepts the following params:
- node
- word to search
- css class name for highlighting
=====================================================*/
{
var arrRemove = [];
for(var i=0; i<o.highlightedNodes.length; i++){
var n = o.highlightedNodes[i];
if(!n){ continue; }
var tempNodeVal = n.nodeValue.tf_LCase();
var tempWordVal = word.tf_LCase();
if(tempNodeVal.indexOf(tempWordVal) != -1){
var pn = n.parentNode;
if(pn && pn.className == cssClass){
var prevSib = pn.previousSibling;
var nextSib = pn.nextSibling;
if(!prevSib || !nextSib){ continue; }
nextSib.nodeValue = prevSib.nodeValue + n.nodeValue + nextSib.nodeValue;
prevSib.nodeValue = '';
n.nodeValue = '';
arrRemove.push(i);
}
}
}
for(var k=0; k<arrRemove.length; k++){
o.highlightedNodes.splice(arrRemove[k], 1);
}
}

View file

@ -1 +1,72 @@
TF.prototype.SetLoader=function(){if(this.loaderDiv!=null)return;var e=this.fObj;this.loaderTgtId=e.loader_target_id!=undefined?e.loader_target_id:null,this.loaderDiv=null,this.loaderText=e.loader_text!=undefined?e.loader_text:"Loading...",this.loaderHtml=e.loader_html!=undefined?e.loader_html:null,this.loaderCssClass=e.loader_css_class!=undefined?e.loader_css_class:"loader",this.loaderCloseDelay=200,this.onShowLoader=tf_IsFn(e.on_show_loader)?e.on_show_loader:null,this.onHideLoader=tf_IsFn(e.on_hide_loader)?e.on_hide_loader:null;var t=tf_CreateElm("div",["id",this.prfxLoader+this.id]);t.className=this.loaderCssClass;var n=this.loaderTgtId==null?this.gridLayout?this.tblCont:this.tbl.parentNode:tf_Id(this.loaderTgtId);this.loaderTgtId==null?n.insertBefore(t,this.tbl):n.appendChild(t),this.loaderDiv=tf_Id(this.prfxLoader+this.id),this.loaderHtml==null?this.loaderDiv.appendChild(tf_CreateText(this.loaderText)):this.loaderDiv.innerHTML=this.loaderHtml},TF.prototype.RemoveLoader=function(){if(this.loaderDiv==null)return;var e=this.loaderTgtId==null?this.gridLayout?this.tblCont:this.tbl.parentNode:tf_Id(this.loaderTgtId);e.removeChild(this.loaderDiv),this.loaderDiv=null},TF.prototype.ShowLoader=function(e){function n(){if(!t.loaderDiv)return;t.onShowLoader&&e!="none"&&t.onShowLoader.call(null,t),t.loaderDiv.style.display=e,t.onHideLoader&&e=="none"&&t.onHideLoader.call(null,t)}if(!this.loader||!this.loaderDiv)return;if(this.loaderDiv.style.display==e)return;var t=this,r=e=="none"?this.loaderCloseDelay:1;window.setTimeout(n,r)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Loader feature v1.1
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetLoader = function()
/*====================================================
- generates loader div
=====================================================*/
{
if( this.loaderDiv!=null ) return;
var f = this.fObj;
this.loaderTgtId = f.loader_target_id!=undefined //id of container element
? f.loader_target_id : null;
this.loaderDiv = null; //div containing loader
this.loaderText = f.loader_text!=undefined ? f.loader_text : 'Loading...'; //defines loader text
this.loaderHtml = f.loader_html!=undefined ? f.loader_html : null; //defines loader innerHtml
this.loaderCssClass = f.loader_css_class!=undefined //defines css class for loader div
? f.loader_css_class : 'loader';
this.loaderCloseDelay = 200; //delay for hiding loader
this.onShowLoader = tf_IsFn(f.on_show_loader) //calls function before loader is displayed
? f.on_show_loader : null;
this.onHideLoader = tf_IsFn(f.on_hide_loader) //calls function after loader is closed
? f.on_hide_loader : null;
var containerDiv = tf_CreateElm( 'div',['id',this.prfxLoader+this.id] );
containerDiv.className = this.loaderCssClass;// for ie<=6
//containerDiv.style.display = 'none';
var targetEl = (this.loaderTgtId==null)
? (this.gridLayout ? this.tblCont : this.tbl.parentNode) : tf_Id( this.loaderTgtId );
if(this.loaderTgtId==null) targetEl.insertBefore(containerDiv, this.tbl);
else targetEl.appendChild( containerDiv );
this.loaderDiv = tf_Id(this.prfxLoader+this.id);
if(this.loaderHtml==null)
this.loaderDiv.appendChild( tf_CreateText(this.loaderText) );
else this.loaderDiv.innerHTML = this.loaderHtml;
}
TF.prototype.RemoveLoader = function()
/*====================================================
- removes loader div
=====================================================*/
{
if( this.loaderDiv==null ) return;
var targetEl = (this.loaderTgtId==null)
? (this.gridLayout ? this.tblCont : this.tbl.parentNode) : tf_Id( this.loaderTgtId );
targetEl.removeChild(this.loaderDiv);
this.loaderDiv = null;
}
TF.prototype.ShowLoader = function(p)
/*====================================================
- displays/hides loader div
=====================================================*/
{
if(!this.loader || !this.loaderDiv) return;
if(this.loaderDiv.style.display==p) return;
var o = this;
function displayLoader(){
if(!o.loaderDiv) return;
if(o.onShowLoader && p!='none')
o.onShowLoader.call(null,o);
o.loaderDiv.style.display = p;
if(o.onHideLoader && p=='none')
o.onHideLoader.call(null,o);
}
var t = (p=='none') ? this.loaderCloseDelay : 1;
window.setTimeout(displayLoader,t);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1,276 @@
function tf_CreateOpt(e,t,n){var r=n?!0:!1,i=r?tf_CreateElm("option",["value",t],["selected","true"]):tf_CreateElm("option",["value",t]);return i.appendChild(tf_CreateText(e)),i}TF.prototype.PopulateSelect=function(e,t,n){this.EvtManager(this.Evt.name.populateselect,{slcIndex:e,slcExternal:t,slcId:n})},TF.prototype._PopulateSelect=function(e,t,n,r){function k(){if(a=="innerhtml")l+='<option value="">'+o.displayAllText+"</option>";else{var e=tf_CreateOpt(o.enableSlcResetFilter?o.displayAllText:"","");o.enableSlcResetFilter||(e.style.display="none"),s.appendChild(e);if(o.enableEmptyOption){var t=tf_CreateOpt(o.emptyText,o.emOperator);s.appendChild(t)}if(o.enableNonEmptyOption){var n=tf_CreateOpt(o.nonEmptyText,o.nmOperator);s.appendChild(n)}}}function L(){var n=s.value;s.innerHTML="",k();for(var r=0;r<f.length;r++){if(f[r]=="")continue;var i=f[r],u=h?p[r]:f[r],c=!1;t&&o.disableExcludedOptions&&g.tf_Has(i.tf_MatchCase(o.matchCase),o.matchCase)&&(c=!0);if(a=="innerhtml"){var d="";o.fillSlcOnDemand&&n==f[r]&&(d='selected="selected"'),l+='<option value="'+i+'" '+d+(c?'disabled="disabled"':"")+">"+u+"</option>"}else{var y;o.fillSlcOnDemand&&n==f[r]&&o["col"+e]==o.fltTypeSlc?y=tf_CreateOpt(u,i,!0):o["col"+e]!=o.fltTypeMulti?y=tf_CreateOpt(u,i,v[e]!=" "&&i==v[e]?!0:!1):y=tf_CreateOpt(u,i,m.tf_Has(f[r].tf_MatchCase(o.matchCase),o.matchCase)||m.toString().indexOf(i)!=-1?!0:!1),c&&(y.disabled=!0),s.appendChild(y)}}a=="innerhtml"&&(s.innerHTML+=l),s.setAttribute("filled","1")}n=n==undefined?!1:n;var i=this.fltIds[e];if(tf_Id(i)==null&&!n)return;if(tf_Id(r)==null&&n)return;var s=n?tf_Id(r):tf_Id(i),o=this,u=this.tbl.rows,a=this.slcFillingMethod.tf_LCase(),f=[],l="",c,h=this.hasCustomSlcOptions&&this.customSlcOptions.cols.tf_Has(e),p=[],d;t&&this.activeFilterId&&(d=this.activeFilterId.split("_")[0],d=d.split(this.prfxFlt)[1]);var v=[],m=[];this.rememberGridValues&&(v=tf_CookieValueArray(this.fltsValuesCookie,this.separator),v!=undefined&&v.toString().tf_Trim()!=""&&(this.hasCustomSlcOptions&&this.customSlcOptions.cols.tf_Has(e)?m.push(v[e]):m=v[e].split(" "+o.orOperator+" ")));var g=null,y=null;t&&this.disableExcludedOptions&&(g=[],y=[]);for(var b=this.refRow;b<this.nbRows;b++){if(this.hasVisibleRows&&this.visibleRows.tf_Has(b)&&!this.paging)continue;var w=u[b].cells,E=w.length;if(E==this.nbCells&&!h)for(var S=0;S<E;S++)if(e==S&&(!t||t&&this.disableExcludedOptions)||e==S&&t&&(u[b].style.display==""&&!this.paging||this.paging&&(!this.validRowsIndex||this.validRowsIndex&&this.validRowsIndex.tf_Has(b))&&(d==undefined||d==e||d!=e&&this.validRowsIndex.tf_Has(b)))){var x=this.GetCellData(S,w[S]),T=x.tf_MatchCase(this.matchCase);f.tf_Has(T,this.matchCase)||f.push(x),t&&this.disableExcludedOptions&&(y[S]||(y[S]=this.GetFilteredDataCol(S)),!y[S].tf_Has(T,this.matchCase)&&!g.tf_Has(T,this.matchCase)&&!this.isFirstLoad&&g.push(x))}}if(h){var N=this.__getCustomValues(e);f=N[0],p=N[1]}this.sortSlc&&!h&&(this.matchCase?(f.sort(),g&&g.sort()):(f.sort(tf_IgnoreCaseSort),g&&g.sort(tf_IgnoreCaseSort)));if(this.sortNumAsc&&this.sortNumAsc.tf_Has(e))try{f.sort(tf_NumSortAsc),g&&g.sort(tf_NumSortAsc),h&&p.sort(tf_NumSortAsc)}catch(C){f.sort(),g&&g.sort(),h&&p.sort()}if(this.sortNumDesc&&this.sortNumDesc.tf_Has(e))try{f.sort(tf_NumSortDesc),g&&g.sort(tf_NumSortDesc),h&&p.sort(tf_NumSortDesc)}catch(C){f.sort(),g&&g.sort(),h&&p.sort()}L()},TF.prototype.__deferMultipleSelection=function(e,t,n){if(e.nodeName.tf_LCase()!="select")return;var r=n==undefined?!1:n,i=this;window.setTimeout(function(){e.options[0].selected=!1,e.options[t].value==""?e.options[t].selected=!1:e.options[t].selected=!0,r&&i.Filter()},.1)},TF.prototype.__getCustomValues=function(e){if(e==undefined)return;var t=this.hasCustomSlcOptions&&this.customSlcOptions.cols.tf_Has(e);if(!t)return;var n=[],r=[],i=this.customSlcOptions.cols.tf_IndexByValue(e),s=this.customSlcOptions.values[i],o=this.customSlcOptions.texts[i],u=this.customSlcOptions.sorts[i];for(var a=0;a<s.length;a++)r.push(s[a]),o[a]!=undefined?n.push(o[a]):n.push(s[a]);return u&&(r.sort(),n.sort()),[r,n]};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Populate Select filters feature v1.2
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.PopulateSelect = function(colIndex,isExternal,extSlcId)
{
this.EvtManager(
this.Evt.name.populateselect,
{ slcIndex:colIndex, slcExternal:isExternal, slcId:extSlcId }
);
}
TF.prototype._PopulateSelect = function(colIndex,isRefreshed,isExternal,extSlcId)
/*====================================================
- populates drop-down filters
=====================================================*/
{
isExternal = (isExternal==undefined) ? false : isExternal;
var slcId = this.fltIds[colIndex];
if( tf_Id(slcId)==null && !isExternal ) return;
if( tf_Id(extSlcId)==null && isExternal ) return;
var slc = (!isExternal) ? tf_Id(slcId) : tf_Id(extSlcId);
var o = this, row = this.tbl.rows;
var fillMethod = this.slcFillingMethod.tf_LCase();
var optArray = [], slcInnerHtml = '', opt0;
var isCustomSlc = (this.hasCustomSlcOptions //custom select test
&& this.customSlcOptions.cols.tf_Has(colIndex));
var optTxt = []; //custom selects text
var activeFlt;
if(isRefreshed && this.activeFilterId){
activeFlt = this.activeFilterId.split('_')[0];
activeFlt = activeFlt.split(this.prfxFlt)[1];
}
/*** remember grid values ***/
var flts_values = [], fltArr = [];
if(this.rememberGridValues)
{
flts_values = tf_CookieValueArray(this.fltsValuesCookie, this.separator);
if(flts_values != undefined && flts_values.toString().tf_Trim() != ''){
if(this.hasCustomSlcOptions && this.customSlcOptions.cols.tf_Has(colIndex)){
fltArr.push(flts_values[colIndex]);
} else { fltArr = flts_values[colIndex].split(' '+o.orOperator+' '); }
}
}
var excludedOpts = null, filteredDataCol = null;
if(isRefreshed && this.disableExcludedOptions){ excludedOpts = []; filteredDataCol = []; }
for(var k=this.refRow; k<this.nbRows; k++)
{
// always visible rows don't need to appear on selects as always valid
if( this.hasVisibleRows && this.visibleRows.tf_Has(k) && !this.paging )
continue;
var cell = row[k].cells;
var nchilds = cell.length;
if(nchilds == this.nbCells && !isCustomSlc)
{// checks if row has exact cell #
for(var j=0; j<nchilds; j++)// this loop retrieves cell data
{
if((colIndex==j && (!isRefreshed || (isRefreshed && this.disableExcludedOptions))) ||
(colIndex==j && isRefreshed && ((row[k].style.display == '' && !this.paging) ||
( this.paging && (!this.validRowsIndex || (this.validRowsIndex && this.validRowsIndex.tf_Has(k)))
&& ((activeFlt==undefined || activeFlt==colIndex) || (activeFlt!=colIndex && this.validRowsIndex.tf_Has(k) ))) )))
{
var cell_data = this.GetCellData(j, cell[j]);
var cell_string = cell_data.tf_MatchCase(this.matchCase);//V<>ry P<>ter's patch
// checks if celldata is already in array
if(!optArray.tf_Has(cell_string,this.matchCase)) optArray.push(cell_data);
if(isRefreshed && this.disableExcludedOptions){
if(!filteredDataCol[j]) filteredDataCol[j] = this.GetFilteredDataCol(j);
if(!filteredDataCol[j].tf_Has(cell_string,this.matchCase)
&& !excludedOpts.tf_Has(cell_string,this.matchCase) && !this.isFirstLoad) excludedOpts.push(cell_data);
}
}//if colIndex==j
}//for j
}//if
}//for k
//Retrieves custom values
if(isCustomSlc)
{
var customValues = this.__getCustomValues(colIndex);
optArray = customValues[0];
optTxt = customValues[1];
}
if(this.sortSlc && !isCustomSlc){
if (!this.matchCase){
optArray.sort(tf_IgnoreCaseSort);
if(excludedOpts) excludedOpts.sort(tf_IgnoreCaseSort);
} else { optArray.sort(); if(excludedOpts){ excludedOpts.sort(); } }
}
if(this.sortNumAsc && this.sortNumAsc.tf_Has(colIndex))
{//asc sort
try{
optArray.sort( tf_NumSortAsc );
if(excludedOpts) excludedOpts.sort( tf_NumSortAsc );
if(isCustomSlc) optTxt.sort( tf_NumSortAsc );
} catch(e) {
optArray.sort(); if(excludedOpts){ excludedOpts.sort(); }
if(isCustomSlc) optTxt.sort();
}//in case there are alphanumeric values
}
if(this.sortNumDesc && this.sortNumDesc.tf_Has(colIndex))
{//desc sort
try{
optArray.sort( tf_NumSortDesc );
if(excludedOpts) excludedOpts.sort( tf_NumSortDesc );
if(isCustomSlc) optTxt.sort( tf_NumSortDesc );
} catch(e) {
optArray.sort(); if(excludedOpts){ excludedOpts.sort(); }
if(isCustomSlc) optTxt.sort();
}//in case there are alphanumeric values
}
AddOpts();//populates drop-down
function AddOpt0()
{// adds 1st option
if( fillMethod == 'innerhtml' )
slcInnerHtml += '<option value="">'+o.displayAllText+'</option>';
else {
var opt0 = tf_CreateOpt((!o.enableSlcResetFilter ? '' : o.displayAllText),'');
if(!o.enableSlcResetFilter) opt0.style.display = 'none';
slc.appendChild(opt0);
if(o.enableEmptyOption){
var opt1 = tf_CreateOpt(o.emptyText,o.emOperator);
slc.appendChild(opt1);
}
if(o.enableNonEmptyOption){
var opt2 = tf_CreateOpt(o.nonEmptyText,o.nmOperator);
slc.appendChild(opt2);
}
}
}
function AddOpts()
{// populates select
var slcValue = slc.value;
slc.innerHTML = '';
AddOpt0();
for(var y=0; y<optArray.length; y++)
{
if(optArray[y]=='') continue;
var val = optArray[y]; //option value
var lbl = (isCustomSlc) ? optTxt[y] : optArray[y]; //option text
var isDisabled = false;
if(isRefreshed && o.disableExcludedOptions &&
excludedOpts.tf_Has(val.tf_MatchCase(o.matchCase), o.matchCase))
isDisabled = true;
if( fillMethod == 'innerhtml' )
{
var slcAttr = '';
if( o.fillSlcOnDemand && slcValue==optArray[y] )
slcAttr = 'selected="selected"';
slcInnerHtml += '<option value="'+val+'" '
+slcAttr+ (isDisabled ? 'disabled="disabled"' : '')+'>'+lbl+'</option>';
} else {
var opt;
//fill select on demand
if(o.fillSlcOnDemand && slcValue==optArray[y] && o['col'+colIndex]==o.fltTypeSlc)
opt = tf_CreateOpt( lbl, val, true );
else{
if( o['col'+colIndex]!=o.fltTypeMulti )
opt = tf_CreateOpt( lbl, val,
(flts_values[colIndex]!=' ' && val==flts_values[colIndex])
? true : false );
else
{
opt = tf_CreateOpt( lbl, val,
(fltArr.tf_Has(optArray[y].tf_MatchCase(o.matchCase),o.matchCase)
|| fltArr.toString().indexOf(val)!= -1)
? true : false );
}
}
if(isDisabled) opt.disabled = true;
slc.appendChild(opt);
}
}// for y
if( fillMethod == 'innerhtml' ) slc.innerHTML += slcInnerHtml;
slc.setAttribute('filled','1');
}// fn AddOpt
}
TF.prototype.__deferMultipleSelection = function(slc,index,filter)
/*====================================================
- IE bug: it seems there is no way to make
multiple selections programatically, only last
selection is kept (multiple select previously
populated via DOM)
- Work-around: defer selection with a setTimeout
If you find a more elegant solution to
this let me know ;-)
- For the moment only this solution seems
to work!
- Params:
- slc = select object (select obj)
- index to be selected (integer)
- execute filtering (boolean)
=====================================================*/
{
if(slc.nodeName.tf_LCase() != 'select') return;
var doFilter = (filter==undefined) ? false : filter;
var o = this;
window.setTimeout(
function(){
slc.options[0].selected = false;
if(slc.options[index].value=='')
slc.options[index].selected = false;
else
slc.options[index].selected = true;
if(doFilter) o.Filter();
},
.1
);
}
TF.prototype.__getCustomValues = function(colIndex)
/*====================================================
- Returns an array [[values],[texts]] with
custom values for a given filter
- Param: column index (integer)
=====================================================*/
{
if(colIndex==undefined) return;
var isCustomSlc = (this.hasCustomSlcOptions //custom select test
&& this.customSlcOptions.cols.tf_Has(colIndex));
if(!isCustomSlc) return;
var optTxt = [], optArray = [];
var index = this.customSlcOptions.cols.tf_IndexByValue(colIndex);
var slcValues = this.customSlcOptions.values[index];
var slcTexts = this.customSlcOptions.texts[index];
var slcSort = this.customSlcOptions.sorts[index];
for(var r=0; r<slcValues.length; r++)
{
optArray.push(slcValues[r]);
if(slcTexts[r]!=undefined)
optTxt.push(slcTexts[r]);
else
optTxt.push(slcValues[r]);
}
if(slcSort)
{
optArray.sort();
optTxt.sort();
}
return [optArray,optTxt];
}
function tf_CreateOpt(text,value,isSel)
/*====================================================
- creates an option element and returns it:
- text: displayed text (string)
- value: option value (string)
- isSel: is selected option (boolean)
=====================================================*/
{
var isSelected = isSel ? true : false;
var opt = (isSelected)
? tf_CreateElm('option',['value',value],['selected','true'])
: tf_CreateElm('option',['value',value]);
opt.appendChild(tf_CreateText(text));
return opt;
}

View file

@ -1 +1,161 @@
TF.prototype.SetPopupFilterIcons=function(){if(!this.popUpFilters)return;this.isExternalFlt=!0;var e=this.fObj;this.popUpImgFlt=e.popup_filters_image!=undefined?e.popup_filters_image:this.themesPath+"icn_filter.gif",this.popUpImgFltActive=e.popup_filters_image_active!=undefined?e.popup_filters_image_active:this.themesPath+"icn_filterActive.gif",this.popUpImgFltHtml=e.popup_filters_image_html!=undefined?e.popup_filters_image_html:'<img src="'+this.popUpImgFlt+'" alt="Column filter" />',this.popUpDivCssClass=e.popup_div_css_class!=undefined?e.popup_div_css_class:"popUpFilter",this.onBeforePopUpOpen=tf_IsFn(e.on_before_popup_filter_open)?e.on_before_popup_filter_open:null,this.onAfterPopUpOpen=tf_IsFn(e.on_after_popup_filter_open)?e.on_after_popup_filter_open:null,this.onBeforePopUpClose=tf_IsFn(e.on_before_popup_filter_close)?e.on_before_popup_filter_close:null,this.onAfterPopUpClose=tf_IsFn(e.on_after_popup_filter_close)?e.on_after_popup_filter_close:null,this.externalFltTgtIds=[],this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache?this.popUpFltElmCache:[],this.popUpFltAdjustToContainer=!0;var t=this;for(var n=0;n<this.nbCells;n++){if(this["col"+n]==this.fltTypeNone)continue;var r=tf_CreateElm("span",["id",this.prfxPopUpSpan+this.id+"_"+n],["ci",n]);r.innerHTML=this.popUpImgFltHtml;var i=this.GetHeaderElement(n);i.appendChild(r),r.onclick=function(e){var n=e||window.event,r=parseInt(this.getAttribute("ci"));t.CloseAllPopupFilters(r),t.TogglePopupFilter(r);if(t.popUpFltAdjustToContainer){var i=t.popUpFltElms[r],s=t.GetHeaderElement(r),u=s.clientWidth*.95;if(!tf_isNotIE){var a=tf_ObjPosition(s,[s.nodeName])[0];i.style.left=a+"px"}i.style.width=parseInt(u)+"px"}tf_CancelEvent(n),tf_StopEvent(n)},this.popUpFltSpans[n]=r,this.popUpFltImgs[n]=r.firstChild}},TF.prototype.SetPopupFilters=function(){for(var e=0;e<this.popUpFltElmCache.length;e++)this.SetPopupFilter(e,this.popUpFltElmCache[e])},TF.prototype.SetPopupFilter=function(e,t){var n=t?t:tf_CreateElm("div",["id",this.prfxPopUpDiv+this.id+"_"+e]);n.className=this.popUpDivCssClass,this.externalFltTgtIds.push(this.prfxPopUpDiv+this.id+"_"+e);var r=this.GetHeaderElement(e);r.insertBefore(n,r.firstChild),n.onclick=function(e){tf_StopEvent(e||window.event)},this.popUpFltElms[e]=n},TF.prototype.TogglePopupFilter=function(e){var t=this.popUpFltElms[e];t.style.display=="none"||t.style.display==""?(this.onBeforePopUpOpen!=null&&this.onBeforePopUpOpen.call(null,this,this.popUpFltElms[e],e),t.style.display="block",this["col"+e]==this.fltTypeInp&&this.GetFilterElement(e).focus(),this.onAfterPopUpOpen!=null&&this.onAfterPopUpOpen.call(null,this,this.popUpFltElms[e],e)):(this.onBeforePopUpClose!=null&&this.onBeforePopUpClose.call(null,this,this.popUpFltElms[e],e),t.style.display="none",this.onAfterPopUpClose!=null&&this.onAfterPopUpClose.call(null,this,this.popUpFltElms[e],e))},TF.prototype.CloseAllPopupFilters=function(e){for(var t=0;t<this.popUpFltElms.length;t++){if(t==e)continue;var n=this.popUpFltElms[t];n&&(n.style.display="none")}},TF.prototype.RemovePopupFilters=function(){this.popUpFltElmCache=[];for(var e=0;e<this.popUpFltElms.length;e++){var t=this.popUpFltElms[e],n=this.popUpFltSpans[e];t&&(t.parentNode.removeChild(t),this.popUpFltElmCache[e]=t),t=null,n&&n.parentNode.removeChild(n),n=null}},TF.prototype.SetPopupFilterIcon=function(e,t){var n=t==undefined?!0:t;this.popUpFltImgs[e]&&(this.popUpFltImgs[e].src=t?this.popUpImgFltActive:this.popUpImgFlt)},TF.prototype.SetAllPopupFiltersIcon=function(e){var t=e==undefined?!1:e;for(var n=0;n<this.popUpFltImgs.length;n++)this.SetPopupFilterIcon(n,!1)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Popup filters feature v1.2
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetPopupFilterIcons = function()
/*====================================================
- generates popup filters div
=====================================================*/
{
if(!this.popUpFilters) return;
this.isExternalFlt = true; //external filters behaviour is enabled
var f = this.fObj;
this.popUpImgFlt = f.popup_filters_image!=undefined //filter icon path
? f.popup_filters_image : this.themesPath+'icn_filter.gif';
this.popUpImgFltActive = f.popup_filters_image_active!=undefined //active filter icon path
? f.popup_filters_image_active : this.themesPath+'icn_filterActive.gif';
this.popUpImgFltHtml = f.popup_filters_image_html!=undefined
? f.popup_filters_image_html : '<img src="'+ this.popUpImgFlt +'" alt="Column filter" />';
this.popUpDivCssClass = f.popup_div_css_class!=undefined //defines css class for popup div containing filter
? f.popup_div_css_class : 'popUpFilter';
this.onBeforePopUpOpen = tf_IsFn(f.on_before_popup_filter_open) //callback function before popup filtes is opened
? f.on_before_popup_filter_open : null;
this.onAfterPopUpOpen = tf_IsFn(f.on_after_popup_filter_open) //callback function after popup filtes is opened
? f.on_after_popup_filter_open : null;
this.onBeforePopUpClose = tf_IsFn(f.on_before_popup_filter_close) //callback function before popup filtes is closed
? f.on_before_popup_filter_close : null;
this.onAfterPopUpClose = tf_IsFn(f.on_after_popup_filter_close) //callback function after popup filtes is closed
? f.on_after_popup_filter_close : null;
this.externalFltTgtIds = [];
this.popUpFltSpans = []; //stores filters spans
this.popUpFltImgs = []; //stores filters icons
this.popUpFltElms = !this.popUpFltElmCache ? [] : this.popUpFltElmCache; //stores filters containers
this.popUpFltAdjustToContainer = true;
var o = this;
for(var i=0; i<this.nbCells; i++){
if(this['col'+i] == this.fltTypeNone) continue;
var popUpSpan = tf_CreateElm('span', ['id', this.prfxPopUpSpan+this.id+'_'+i], ['ci',i]);
popUpSpan.innerHTML = this.popUpImgFltHtml;
var header = this.GetHeaderElement(i);
header.appendChild(popUpSpan);
popUpSpan.onclick = function(e){
var evt = e || window.event;
var colIndex = parseInt(this.getAttribute('ci'));
o.CloseAllPopupFilters(colIndex);
o.TogglePopupFilter(colIndex);
if(o.popUpFltAdjustToContainer){
var popUpDiv = o.popUpFltElms[colIndex];
var header = o.GetHeaderElement(colIndex);
var headerWidth = header.clientWidth * .95;
if(!tf_isNotIE){
var headerLeft = tf_ObjPosition(header, [header.nodeName])[0];
popUpDiv.style.left = (headerLeft) + 'px';
}
popUpDiv.style.width = parseInt(headerWidth) + 'px';
}
tf_CancelEvent(evt);
tf_StopEvent(evt);
};
this.popUpFltSpans[i] = popUpSpan;
this.popUpFltImgs[i] = popUpSpan.firstChild;
}
}
TF.prototype.SetPopupFilters = function()
/*====================================================
- generates all popup filters div
=====================================================*/
{
for(var i=0; i<this.popUpFltElmCache.length; i++)
this.SetPopupFilter(i, this.popUpFltElmCache[i]);
}
TF.prototype.SetPopupFilter = function(colIndex, div)
/*====================================================
- generates a popup filters div for specifies
column
=====================================================*/
{
var popUpDiv = !div ? tf_CreateElm('div', ['id', this.prfxPopUpDiv+this.id+'_'+colIndex]) : div;
popUpDiv.className = this.popUpDivCssClass;
this.externalFltTgtIds.push(this.prfxPopUpDiv+this.id+'_'+colIndex);
var header = this.GetHeaderElement(colIndex);
header.insertBefore(popUpDiv, header.firstChild);
popUpDiv.onclick = function(e){ tf_StopEvent(e || window.event); };
this.popUpFltElms[colIndex] = popUpDiv;
}
TF.prototype.TogglePopupFilter = function(colIndex)
/*====================================================
- toggles popup filters div
=====================================================*/
{
var popUpFltElm = this.popUpFltElms[colIndex];
if(popUpFltElm.style.display == 'none' || popUpFltElm.style.display == ''){
if(this.onBeforePopUpOpen!=null) this.onBeforePopUpOpen.call(null,this, this.popUpFltElms[colIndex],colIndex);
popUpFltElm.style.display = 'block';
if(this['col'+colIndex] == this.fltTypeInp) this.GetFilterElement(colIndex).focus();
if(this.onAfterPopUpOpen!=null) this.onAfterPopUpOpen.call(null,this, this.popUpFltElms[colIndex],colIndex);
} else {
if(this.onBeforePopUpClose!=null) this.onBeforePopUpClose.call(null,this, this.popUpFltElms[colIndex],colIndex);
popUpFltElm.style.display = 'none';
if(this.onAfterPopUpClose!=null) this.onAfterPopUpClose.call(null,this, this.popUpFltElms[colIndex],colIndex);
}
}
TF.prototype.CloseAllPopupFilters = function(exceptColIndex)
/*====================================================
- closes all popup filters
=====================================================*/
{
for(var i=0; i<this.popUpFltElms.length; i++){
if(i == exceptColIndex) continue;
var popUpFltElm = this.popUpFltElms[i];
if(popUpFltElm) popUpFltElm.style.display = 'none';
}
}
TF.prototype.RemovePopupFilters = function()
/*====================================================
- removes popup filters div
=====================================================*/
{
this.popUpFltElmCache = [];
for(var i=0; i<this.popUpFltElms.length; i++){
var popUpFltElm = this.popUpFltElms[i];
var popUpFltSpan = this.popUpFltSpans[i];
if(popUpFltElm){
popUpFltElm.parentNode.removeChild(popUpFltElm);
this.popUpFltElmCache[i] = popUpFltElm;
}
popUpFltElm = null;
if(popUpFltSpan) popUpFltSpan.parentNode.removeChild(popUpFltSpan);
popUpFltSpan = null;
}
}
TF.prototype.SetPopupFilterIcon = function(colIndex, active)
/*====================================================
- sets inactive or active filter icon
=====================================================*/
{
var activeImg = active==undefined ? true : active;
if(this.popUpFltImgs[colIndex])
this.popUpFltImgs[colIndex].src = (active) ? this.popUpImgFltActive : this.popUpImgFlt;
}
TF.prototype.SetAllPopupFiltersIcon = function(active)
/*====================================================
- sets inactive or active filter icon for all
filters
=====================================================*/
{
var activeImg = active==undefined ? false : active;
for(var i=0; i<this.popUpFltImgs.length; i++)
this.SetPopupFilterIcon(i, false);
}

View file

@ -1 +1,230 @@
TF.prototype.HasGrid=function(){return this.hasGrid},TF.prototype.GetFiltersId=function(){if(!this.hasGrid)return;return this.fltIds},TF.prototype.GetValidRowsIndex=function(e){if(!this.hasGrid)return;if(!e)return this.validRowsIndex;this.validRowsIndex=[];for(var t=this.refRow;t<this.GetRowsNb(!0);t++){var n=this.tbl.rows[t];this.paging?(n.getAttribute("validRow")=="true"||n.getAttribute("validRow")==null)&&this.validRowsIndex.push(n.rowIndex):this.GetRowDisplay(n)!="none"&&this.validRowsIndex.push(n.rowIndex)}return this.validRowsIndex},TF.prototype.GetFiltersRowIndex=function(){if(!this.hasGrid)return;return this.filtersRowIndex},TF.prototype.GetHeadersRowIndex=function(){if(!this.hasGrid)return;return this.headersRow},TF.prototype.GetStartRowIndex=function(){if(!this.hasGrid)return;return this.refRow},TF.prototype.GetLastRowIndex=function(){if(!this.hasGrid)return;return this.nbRows-1},TF.prototype.GetHeaderElement=function(e){var t=this.gridLayout?this.headTbl:this.tbl,n,r=tf_Tag(this.tbl,"thead");for(var i=0;i<this.nbCells;i++){if(i!=e)continue;r.length==0&&(n=t.rows[this.headersRow].cells[i]),r.length==1&&(n=r[0].rows[this.headersRow].cells[i]);break}return n},TF.prototype.GetTableData=function(){var e=this.tbl.rows;for(var t=this.refRow;t<this.nbRows;t++){var n,r;n=[t,[]];var i=e[t].cells;for(var s=0;s<i.length;s++){var o=this.GetCellData(s,i[s]);n[1].push(o)}this.tblData.push(n)}return this.tblData},TF.prototype.GetFilteredData=function(e){if(!this.validRowsIndex)return[];var t=this.tbl.rows,n=[];if(e){var r=this.gridLayout?this.headTbl:this.tbl,i=r.rows[this.headersRow],s=[i.rowIndex,[]];for(var o=0;o<this.nbCells;o++){var u=this.GetCellData(o,i.cells[o]);s[1].push(u)}n.push(s)}var a=this.GetValidRowsIndex(!0);for(var f=0;f<a.length;f++){var s,l;s=[this.validRowsIndex[f],[]];var c=t[this.validRowsIndex[f]].cells;for(var o=0;o<c.length;o++){var h=this.GetCellData(o,c[o]);s[1].push(h)}n.push(s)}return n},TF.prototype.GetFilteredDataCol=function(e){if(e==undefined)return[];var t=this.GetFilteredData(),n=[];for(var r=0;r<t.length;r++){var i=t[r],s=i[1],o=s[e];n.push(o)}return n},TF.prototype.GetConfigObject=function(){return this.fObj},TF.prototype.GetImportedModules=function(){return this.importedModules||[]},TF.prototype.GetFilterableRowsNb=function(){return this.GetRowsNb(!1)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Additional handy public methods for developers v1.3
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.HasGrid = function()
/*====================================================
- checks if table has a filter grid
- returns a boolean
=====================================================*/
{
return this.hasGrid;
}
TF.prototype.GetFiltersId = function()
/*====================================================
- returns an array containing filters ids
- Note that hidden filters are also returned
=====================================================*/
{
if( !this.hasGrid ) return;
return this.fltIds;
}
TF.prototype.GetValidRowsIndex = function(reCalc)
/*====================================================
- returns an array containing valid rows indexes
(valid rows upon filtering)
=====================================================*/
{
if( !this.hasGrid ) return;
if(!reCalc){ return this.validRowsIndex; }
this.validRowsIndex = [];
for(var k=this.refRow; k<this.GetRowsNb(true); k++){
var r = this.tbl.rows[k];
if(!this.paging){
if(this.GetRowDisplay(r) != 'none')
this.validRowsIndex.push(r.rowIndex);
} else {
if(r.getAttribute('validRow') == 'true' || r.getAttribute('validRow') == null)
this.validRowsIndex.push(r.rowIndex);
}
}
return this.validRowsIndex;
}
TF.prototype.GetFiltersRowIndex = function()
/*====================================================
- Returns the index of the row containing the
filters
=====================================================*/
{
if( !this.hasGrid ) return;
return this.filtersRowIndex;
}
TF.prototype.GetHeadersRowIndex = function()
/*====================================================
- Returns the index of the headers row
=====================================================*/
{
if( !this.hasGrid ) return;
return this.headersRow;
}
TF.prototype.GetStartRowIndex = function()
/*====================================================
- Returns the index of the row from which will
start the filtering process (1st filterable row)
=====================================================*/
{
if( !this.hasGrid ) return;
return this.refRow;
}
TF.prototype.GetLastRowIndex = function()
/*====================================================
- Returns the index of the last row
=====================================================*/
{
if( !this.hasGrid ) return;
return (this.nbRows-1);
}
//TF.prototype.AddPaging = function(filterTable)
/*====================================================
- Adds paging feature if filter grid bar is
already set
- Param(s):
- execFilter: if true table is filtered
(boolean)
=====================================================*/
/*{
if( !this.hasGrid || this.paging ) return;
this.paging = true;
this.isPagingRemoved = true;
this.SetPaging();
if(filterTable) this.Filter();
}*/
TF.prototype.GetHeaderElement = function(colIndex)
/*====================================================
- returns a header DOM element for a given column
index
=====================================================*/
{
var table = (this.gridLayout) ? this.headTbl : this.tbl;
var header, tHead = tf_Tag(this.tbl,'thead');
for(var i=0; i<this.nbCells; i++)
{
if(i != colIndex) continue;
if(tHead.length == 0)
header = table.rows[this.headersRow].cells[i];
if(tHead.length == 1)
header = tHead[0].rows[this.headersRow].cells[i];
break;
}
return header;
}
TF.prototype.GetTableData = function()
/*====================================================
- returns an array containing table data:
[rowindex,[value1,value2,value3...]]
=====================================================*/
{
var row = this.tbl.rows;
for(var k=this.refRow; k<this.nbRows; k++)
{
var rowData, cellData;
rowData = [k,[]];
var cells = row[k].cells;
for(var j=0; j<cells.length; j++)
{// this loop retrieves cell data
var cell_data = this.GetCellData(j, cells[j]);
rowData[1].push(cell_data);
}
this.tblData.push(rowData)
}
return this.tblData;
}
TF.prototype.GetFilteredData = function(includeHeaders)
/*====================================================
- returns an array containing filtered data:
[rowindex,[value1,value2,value3...]]
=====================================================*/
{
if(!this.validRowsIndex) return [];
var row = this.tbl.rows;
var filteredData = [];
if(includeHeaders){
var table = (this.gridLayout) ? this.headTbl : this.tbl;
var r = table.rows[this.headersRow];
var rowData = [r.rowIndex,[]];
for(var j=0; j<this.nbCells; j++)
{
var headerText = this.GetCellData(j, r.cells[j]);
rowData[1].push(headerText);
}
filteredData.push(rowData);
}
//for(var i=0; i<this.validRowsIndex.length; i++)
var validRows = this.GetValidRowsIndex(true);
for(var i=0; i<validRows.length; i++)
{
var rowData, cellData;
rowData = [this.validRowsIndex[i],[]];
var cells = row[this.validRowsIndex[i]].cells;
for(var j=0; j<cells.length; j++)
{
var cell_data = this.GetCellData(j, cells[j]);
rowData[1].push(cell_data);
}
filteredData.push(rowData);
}
return filteredData;
}
TF.prototype.GetFilteredDataCol = function(colIndex)
/*====================================================
- returns an array containing filtered data of a
specified column.
- Params:
- colIndex: index of the column (number)
- returned array:
[value1,value2,value3...]
=====================================================*/
{
if(colIndex==undefined) return [];
var data = this.GetFilteredData();
var colData = [];
for(var i=0; i<data.length; i++)
{
var r = data[i];
var d = r[1]; //cols values of current row
var c = d[colIndex]; //data of searched column
colData.push(c);
}
return colData;
}
TF.prototype.GetConfigObject = function()
/*====================================================
- returns the original configuration object
=====================================================*/
{
return this.fObj;
}
TF.prototype.GetImportedModules = function()
/*====================================================
- returns the modules imported by the
tablefilter.js document
=====================================================*/
{
return this.importedModules || [];
}
TF.prototype.GetFilterableRowsNb = function()
/*====================================================
- returns the total number of rows that can be
filtered
=====================================================*/
{
return this.GetRowsNb(false);
}

View file

@ -1 +1,51 @@
TF.prototype.RefreshFiltersGrid=function(){var e=this.GetFiltersByType(this.fltTypeSlc,!0),t=this.GetFiltersByType(this.fltTypeMulti,!0),n=this.GetFiltersByType(this.fltTypeCheckList,!0),r=e.concat(t);r=r.concat(n);if(this.activeFilterId!=null){var i=this.activeFilterId.split("_")[0];i=i.split(this.prfxFlt)[1];var s;for(var o=0;o<r.length;o++){var u=tf_Id(this.fltIds[r[o]]);s=this.GetFilterValue(r[o]);if(i!=r[o]||this.paging&&e.tf_Has(r[o])&&i==r[o]||!this.paging&&(n.tf_Has(r[o])||t.tf_Has(r[o]))||s==this.displayAllText){n.tf_Has(r[o])?this.checkListDiv[r[o]].innerHTML="":u.innerHTML="";if(this.fillSlcOnDemand){var a=tf_CreateOpt(this.displayAllText,"");u&&u.appendChild(a)}n.tf_Has(r[o])?this._PopulateCheckList(r[o]):this._PopulateSelect(r[o],!0),this.SetFilterValue(r[o],s)}}}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Refresh filters feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.RefreshFiltersGrid = function()
/*====================================================
- retrieves select, multiple and checklist filters
- calls method repopulating filters
=====================================================*/
{
var slcA1 = this.GetFiltersByType( this.fltTypeSlc,true );
var slcA2 = this.GetFiltersByType( this.fltTypeMulti,true );
var slcA3 = this.GetFiltersByType( this.fltTypeCheckList,true );
var slcIndex = slcA1.concat(slcA2);
slcIndex = slcIndex.concat(slcA3);
if( this.activeFilterId!=null )//for paging
{
var activeFlt = this.activeFilterId.split('_')[0];
activeFlt = activeFlt.split(this.prfxFlt)[1];
var slcSelectedValue;
for(var i=0; i<slcIndex.length; i++)
{
var curSlc = tf_Id(this.fltIds[slcIndex[i]]);
slcSelectedValue = this.GetFilterValue( slcIndex[i] );
if(activeFlt!=slcIndex[i] || (this.paging && slcA1.tf_Has(slcIndex[i]) && activeFlt==slcIndex[i] ) ||
( !this.paging && (slcA3.tf_Has(slcIndex[i]) || slcA2.tf_Has(slcIndex[i]) )) ||
slcSelectedValue==this.displayAllText )
{
if(slcA3.tf_Has(slcIndex[i]))
this.checkListDiv[slcIndex[i]].innerHTML = '';
else curSlc.innerHTML = '';
if(this.fillSlcOnDemand) { //1st option needs to be inserted
var opt0 = tf_CreateOpt(this.displayAllText,'');
if(curSlc) curSlc.appendChild( opt0 );
}
if(slcA3.tf_Has(slcIndex[i]))
this._PopulateCheckList(slcIndex[i]);
else
this._PopulateSelect(slcIndex[i],true);
this.SetFilterValue(slcIndex[i],slcSelectedValue);
}
}// for i
}
}

View file

@ -1 +1,174 @@
TF.prototype.SetResetBtn=function(){if(!this.hasGrid&&!this.isFirstLoad)return;if(this.btnResetEl!=null)return;var e=this.fObj;this.btnResetTgtId=e.btn_reset_target_id!=undefined?e.btn_reset_target_id:null,this.btnResetEl=null,this.btnResetText=e.btn_reset_text!=undefined?e.btn_reset_text:"Reset",this.btnResetTooltip=e.btn_reset_tooltip!=undefined?e.btn_reset_tooltip:"Clear filters",this.btnResetHtml=e.btn_reset_html!=undefined?e.btn_reset_html:this.enableIcons?'<input type="button" value="" class="'+this.btnResetCssClass+'" title="'+this.btnResetTooltip+'" />':null;var t=tf_CreateElm("span",["id",this.prfxResetSpan+this.id]);this.btnResetTgtId==null&&this.SetTopDiv();var n=this.btnResetTgtId==null?this.rDiv:tf_Id(this.btnResetTgtId);n.appendChild(t);if(this.btnResetHtml==null){var r=tf_CreateElm("a",["href","javascript:void(0);"]);r.className=this.btnResetCssClass,r.appendChild(tf_CreateText(this.btnResetText)),t.appendChild(r),r.onclick=this.Evt._Clear}else{t.innerHTML=this.btnResetHtml;var i=t.firstChild;i.onclick=this.Evt._Clear}this.btnResetEl=tf_Id(this.prfxResetSpan+this.id).firstChild},TF.prototype.RemoveResetBtn=function(){if(!this.hasGrid)return;if(this.btnResetEl==null)return;var e=tf_Id(this.prfxResetSpan+this.id);e!=null&&e.parentNode.removeChild(e),this.btnResetEl=null},TF.prototype.SetHelpInstructions=function(){if(this.helpInstrBtnEl!=null)return;var e=this.fObj;this.helpInstrTgtId=e.help_instructions_target_id!=undefined?e.help_instructions_target_id:null,this.helpInstrContTgtId=e.help_instructions_container_target_id!=undefined?e.help_instructions_container_target_id:null,this.helpInstrText=e.help_instructions_text?e.help_instructions_text:'Use the filters above each column to filter and limit table data. Avanced searches can be performed by using the following operators: <br /><i>&lt;</i>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>=</b>, <b>*</b>, <b>!</b>, <b>{</b>, <b>}</b>, <b>||</b>, <b>&amp;&amp;</b>, <b>[empty]</b>, <b>[nonempty]</b>, <b>rgx:</b><br/> These operators are described here:<br/><a href="http://tablefilter.free.fr/#operators" target="_blank">http://tablefilter.free.fr/#operators</a><hr/>',this.helpInstrHtml=e.help_instructions_html!=undefined?e.help_instructions_html:null,this.helpInstrBtnText=e.help_instructions_btn_text!=undefined?e.help_instructions_btn_text:"?",this.helpInstrBtnHtml=e.help_instructions_btn_html!=undefined?e.help_instructions_btn_html:null,this.helpInstrBtnCssClass=e.help_instructions_btn_css_class!=undefined?e.help_instructions_btn_css_class:"helpBtn",this.helpInstrContCssClass=e.help_instructions_container_css_class!=undefined?e.help_instructions_container_css_class:"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='<div class="helpFooter"><h4>HTML Table Filter Generator v. '+this.version+"</h4>"+'<a href="http://tablefilter.free.fr" target="_blank">http://tablefilter.free.fr</a><br/>'+"<span>&copy;2009-"+this.year+' Max Guglielmi.</span><div align="center" style="margin-top:8px;">'+'<a href="javascript:;" onclick="window[\'tf_'+this.id+"']._ToggleHelp();\">Close</a></div></div>";var t=tf_CreateElm("span",["id",this.prfxHelpSpan+this.id]),n=tf_CreateElm("div",["id",this.prfxHelpDiv+this.id]);this.helpInstrTgtId==null&&this.SetTopDiv();var r=this.helpInstrTgtId==null?this.rDiv:tf_Id(this.helpInstrTgtId);r.appendChild(t);var i=this.helpInstrContTgtId==null?t:tf_Id(this.helpInstrContTgtId);if(this.helpInstrBtnHtml==null){i.appendChild(n);var s=tf_CreateElm("a",["href","javascript:void(0);"]);s.className=this.helpInstrBtnCssClass,s.appendChild(tf_CreateText(this.helpInstrBtnText)),t.appendChild(s),s.onclick=this.Evt._OnHelpBtnClick}else{t.innerHTML+=this.helpInstrBtnHtml;var o=t.firstChild;o.onclick=this.Evt._OnHelpBtnClick,i.appendChild(n)}this.helpInstrHtml==null?(n.innerHTML=this.helpInstrText,n.className=this.helpInstrContCssClass,n.ondblclick=this.Evt._OnHelpBtnClick):(this.helpInstrContTgtId&&i.appendChild(n),n.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(n.className=this.helpInstrContCssClass,n.ondblclick=this.Evt._OnHelpBtnClick)),n.innerHTML+=this.helpInstrDefaultHtml,this.helpInstrContEl=n,this.helpInstrBtnEl=t},TF.prototype.RemoveHelpInstructions=function(){if(this.helpInstrBtnEl==null)return;this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null;if(this.helpInstrContEl==null)return;this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null},TF.prototype._ToggleHelp=function(){if(!this.helpInstrContEl)return;var e=this.helpInstrContEl.style.display;if(e==""||e=="none"){this.helpInstrContEl.style.display="block";var t=tf_ObjPosition(this.helpInstrBtnEl,[this.helpInstrBtnEl.nodeName])[0];this.helpInstrContTgtId||(this.helpInstrContEl.style.left=t-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Reset button (clear filters) and Help instructions feature v1.3
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
--------------------------------------------------------------------------
- Changelog:
1.1 [12-09-10]
Help instructions methods added to this module
1.2 [31-07-11]
Button icon shown by default
1.3 [10-03-12]
Added year property to help instructions (helpInstrDefaultHtml)
1.4 [27-04-12]
Modfied help instructions text
------------------------------------------------------------------------*/
TF.prototype.SetResetBtn = function()
/*====================================================
- Generates reset button
=====================================================*/
{
if(!this.hasGrid && !this.isFirstLoad) return;
if( this.btnResetEl!=null ) return;
var f = this.fObj;
this.btnResetTgtId = f.btn_reset_target_id!=undefined //id of container element
? f.btn_reset_target_id : null;
this.btnResetEl = null; //reset button element
this.btnResetText = f.btn_reset_text!=undefined ? f.btn_reset_text : 'Reset'; //defines reset text
this.btnResetTooltip = f.btn_reset_tooltip!=undefined ? f.btn_reset_tooltip : 'Clear filters'; //defines reset button tooltip
this.btnResetHtml = f.btn_reset_html!=undefined ? f.btn_reset_html : (!this.enableIcons ? null : //defines reset button innerHtml
'<input type="button" value="" class="'+this.btnResetCssClass+'" title="'+this.btnResetTooltip+'" />');
var resetspan = tf_CreateElm('span',['id',this.prfxResetSpan+this.id]);
// reset button is added to defined element
if(this.btnResetTgtId==null) this.SetTopDiv();
var targetEl = ( this.btnResetTgtId==null ) ? this.rDiv : tf_Id( this.btnResetTgtId );
targetEl.appendChild(resetspan);
if(this.btnResetHtml==null)
{
var fltreset = tf_CreateElm( 'a', ['href','javascript:void(0);'] );
fltreset.className = this.btnResetCssClass;
fltreset.appendChild(tf_CreateText(this.btnResetText));
resetspan.appendChild(fltreset);
fltreset.onclick = this.Evt._Clear;
} else {
resetspan.innerHTML = this.btnResetHtml;
var resetEl = resetspan.firstChild;
resetEl.onclick = this.Evt._Clear;
}
this.btnResetEl = tf_Id(this.prfxResetSpan+this.id).firstChild;
}
TF.prototype.RemoveResetBtn = function()
/*====================================================
- Removes reset button
=====================================================*/
{
if(!this.hasGrid) return;
if( this.btnResetEl==null ) return;
var resetspan = tf_Id(this.prfxResetSpan+this.id);
if( resetspan!=null )
resetspan.parentNode.removeChild( resetspan );
this.btnResetEl = null;
}
TF.prototype.SetHelpInstructions = function()
/*====================================================
- Generates help instructions
=====================================================*/
{
if( this.helpInstrBtnEl!=null ) return;
var f = this.fObj;
this.helpInstrTgtId = f.help_instructions_target_id!=undefined //id of custom container element for instructions
? f.help_instructions_target_id : null;
this.helpInstrContTgtId = f.help_instructions_container_target_id!=undefined //id of custom container element for instructions
? f.help_instructions_container_target_id : null;
this.helpInstrText = f.help_instructions_text //defines help text
? f.help_instructions_text : 'Use the filters above each column to filter and limit table data. ' +
'Avanced searches can be performed by using the following operators: <br />' +
'<i>&lt;</i>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>=</b>, <b>*</b>, <b>!</b>, <b>{</b>, <b>}</b>, <b>||</b>, ' +
'<b>&amp;&amp;</b>, <b>[empty]</b>, <b>[nonempty]</b>, <b>rgx:</b><br/> These operators are described here:<br/>' +
'<a href="http://tablefilter.free.fr/#operators" target="_blank">http://tablefilter.free.fr/#operators</a><hr/>';
this.helpInstrHtml = f.help_instructions_html!=undefined
? f.help_instructions_html : null; //defines help innerHtml
this.helpInstrBtnText = f.help_instructions_btn_text!=undefined
? f.help_instructions_btn_text : '?'; //defines help button text
this.helpInstrBtnHtml = f.help_instructions_btn_html!=undefined
? f.help_instructions_btn_html : null; //defines reset button innerHtml
this.helpInstrBtnCssClass = f.help_instructions_btn_css_class!=undefined //defines css class for help button
? f.help_instructions_btn_css_class : 'helpBtn';
this.helpInstrContCssClass = f.help_instructions_container_css_class!=undefined //defines css class for help container
? f.help_instructions_container_css_class : 'helpCont';
this.helpInstrBtnEl = null; //help button element
this.helpInstrContEl = null; //help content div
this.helpInstrDefaultHtml = '<div class="helpFooter"><h4>HTML Table Filter Generator v. '+ this.version +'</h4>' +
'<a href="http://tablefilter.free.fr" target="_blank">http://tablefilter.free.fr</a><br/>' +
'<span>&copy;2009-'+ this.year +' Max Guglielmi.</span><div align="center" style="margin-top:8px;">' +
'<a href="javascript:;" onclick="window[\'tf_'+ this.id +'\']._ToggleHelp();">Close</a></div></div>';
var helpspan = tf_CreateElm('span',['id',this.prfxHelpSpan+this.id]);
var helpdiv = tf_CreateElm('div',['id',this.prfxHelpDiv+this.id]);
//help button is added to defined element
if(this.helpInstrTgtId==null) this.SetTopDiv();
var targetEl = ( this.helpInstrTgtId==null ) ? this.rDiv : tf_Id( this.helpInstrTgtId );
targetEl.appendChild(helpspan);
var divContainer = ( this.helpInstrContTgtId==null ) ? helpspan : tf_Id( this.helpInstrContTgtId );
if(this.helpInstrBtnHtml == null)
{
divContainer.appendChild(helpdiv);
var helplink = tf_CreateElm( 'a', ['href','javascript:void(0);'] );
helplink.className = this.helpInstrBtnCssClass;
helplink.appendChild(tf_CreateText(this.helpInstrBtnText));
helpspan.appendChild(helplink);
helplink.onclick = this.Evt._OnHelpBtnClick;
} else {
helpspan.innerHTML += this.helpInstrBtnHtml;
var helpEl = helpspan.firstChild;
helpEl.onclick = this.Evt._OnHelpBtnClick;
divContainer.appendChild(helpdiv);
}
if(this.helpInstrHtml == null)
{
//helpdiv.appendChild(tf_CreateText(this.helpInstrText));
helpdiv.innerHTML = this.helpInstrText;
helpdiv.className = this.helpInstrContCssClass;
helpdiv.ondblclick = this.Evt._OnHelpBtnClick;
} else {
if(this.helpInstrContTgtId) divContainer.appendChild(helpdiv);
helpdiv.innerHTML = this.helpInstrHtml;
if(!this.helpInstrContTgtId){
helpdiv.className = this.helpInstrContCssClass;
helpdiv.ondblclick = this.Evt._OnHelpBtnClick;
}
}
helpdiv.innerHTML += this.helpInstrDefaultHtml;
this.helpInstrContEl = helpdiv;
this.helpInstrBtnEl = helpspan;
}
TF.prototype.RemoveHelpInstructions = function()
/*====================================================
- Removes help instructions
=====================================================*/
{
if(this.helpInstrBtnEl==null) return;
this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl);
this.helpInstrBtnEl = null;
if(this.helpInstrContEl==null) return;
this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl);
this.helpInstrContEl = null;
}
TF.prototype._ToggleHelp = function()
/*====================================================
- Toggles help div
=====================================================*/
{
if(!this.helpInstrContEl) return;
var divDisplay = this.helpInstrContEl.style.display;
if(divDisplay == '' || divDisplay == 'none'){
this.helpInstrContEl.style.display = 'block';
var btnLeft = tf_ObjPosition(this.helpInstrBtnEl, [this.helpInstrBtnEl.nodeName])[0];
if(!this.helpInstrContTgtId)
this.helpInstrContEl.style.left = (btnLeft - this.helpInstrContEl.clientWidth + 25) + 'px';
}
else this.helpInstrContEl.style.display = 'none';
}

View file

@ -1 +1,100 @@
TF.prototype.SetRowsCounter=function(){if(!this.hasGrid&&!this.isFirstLoad)return;if(this.rowsCounterSpan!=null)return;var e=this.fObj;this.rowsCounterTgtId=e.rows_counter_target_id!=undefined?e.rows_counter_target_id:null,this.rowsCounterDiv=null,this.rowsCounterSpan=null,this.rowsCounterText=e.rows_counter_text!=undefined?e.rows_counter_text:"Rows: ",this.fromToTextSeparator=e.from_to_text_separator!=undefined?e.from_to_text_separator:"-",this.overText=e.over_text!=undefined?e.over_text:" / ",this.totRowsCssClass=e.tot_rows_css_class!=undefined?e.tot_rows_css_class:"tot",this.onBeforeRefreshCounter=tf_IsFn(e.on_before_refresh_counter)?e.on_before_refresh_counter:null,this.onAfterRefreshCounter=tf_IsFn(e.on_after_refresh_counter)?e.on_after_refresh_counter:null;var t=tf_CreateElm("div",["id",this.prfxCounter+this.id]);t.className=this.totRowsCssClass;var n=tf_CreateElm("span",["id",this.prfxTotRows+this.id]),r=tf_CreateElm("span",["id",this.prfxTotRowsTxt+this.id]);r.appendChild(tf_CreateText(this.rowsCounterText)),this.rowsCounterTgtId==null&&this.SetTopDiv();var i=this.rowsCounterTgtId==null?this.lDiv:tf_Id(this.rowsCounterTgtId);this.rowsCounterDiv&&tf_isIE&&(this.rowsCounterDiv.outerHTML=""),this.rowsCounterTgtId==null?(t.appendChild(r),t.appendChild(n),i.appendChild(t)):(i.appendChild(r),i.appendChild(n)),this.rowsCounterDiv=tf_Id(this.prfxCounter+this.id),this.rowsCounterSpan=tf_Id(this.prfxTotRows+this.id),this.RefreshNbRows()},TF.prototype.RemoveRowsCounter=function(){if(!this.hasGrid)return;if(this.rowsCounterSpan==null)return;this.rowsCounterTgtId==null&&this.rowsCounterDiv?tf_isIE?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):tf_Id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null},TF.prototype.RefreshNbRows=function(e){if(this.rowsCounterSpan==null)return;this.onBeforeRefreshCounter&&this.onBeforeRefreshCounter.call(null,this,this.rowsCounterSpan);var t;if(!this.paging)e!=undefined&&e!=""?t=e:t=this.nbFilterableRows-this.nbHiddenRows-(this.hasVisibleRows?this.visibleRows.length:0);else{var n=parseInt(this.startPagingRow)+(this.nbVisibleRows>0?1:0),r=n+this.pagingLength-1<=this.nbVisibleRows?n+this.pagingLength-1:this.nbVisibleRows;t=n+this.fromToTextSeparator+r+this.overText+this.nbVisibleRows}this.rowsCounterSpan.innerHTML=t,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,this,this.rowsCounterSpan,t)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Rows counter feature v1.3
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetRowsCounter = function()
/*====================================================
- Generates rows counter label
=====================================================*/
{
if(!this.hasGrid && !this.isFirstLoad) return;
if( this.rowsCounterSpan!=null ) return;
var f = this.fObj;
this.rowsCounterTgtId = f.rows_counter_target_id!=undefined //id of custom container element
? f.rows_counter_target_id : null;
this.rowsCounterDiv = null; //element containing tot nb rows
this.rowsCounterSpan = null; //element containing tot nb rows label
this.rowsCounterText = f.rows_counter_text!=undefined ? f.rows_counter_text : 'Rows: '; //defines rows counter text
this.fromToTextSeparator = f.from_to_text_separator!=undefined ? f.from_to_text_separator : '-';
this.overText = f.over_text!=undefined ? f.over_text : ' / ';
this.totRowsCssClass = f.tot_rows_css_class!=undefined ? f.tot_rows_css_class : 'tot'; //defines css class rows counter
this.onBeforeRefreshCounter = tf_IsFn(f.on_before_refresh_counter) ? f.on_before_refresh_counter : null; //callback raised before counter is refreshed
this.onAfterRefreshCounter = tf_IsFn(f.on_after_refresh_counter) ? f.on_after_refresh_counter : null; //callback raised after counter is refreshed
var countDiv = tf_CreateElm( 'div',['id',this.prfxCounter+this.id] ); //rows counter container
countDiv.className = this.totRowsCssClass;
var countSpan = tf_CreateElm( 'span',['id',this.prfxTotRows+this.id] ); //rows counter label
var countText = tf_CreateElm( 'span',['id',this.prfxTotRowsTxt+this.id] );
countText.appendChild( tf_CreateText(this.rowsCounterText) );
// counter is added to defined element
if(this.rowsCounterTgtId==null) this.SetTopDiv();
var targetEl = ( this.rowsCounterTgtId==null ) ? this.lDiv : tf_Id( this.rowsCounterTgtId );
//IE only: clears all for sure
if(this.rowsCounterDiv && tf_isIE)
this.rowsCounterDiv.outerHTML = '';
if( this.rowsCounterTgtId==null )
{//default container: 'lDiv'
countDiv.appendChild(countText);
countDiv.appendChild(countSpan);
targetEl.appendChild(countDiv);
}
else
{// custom container, no need to append statusDiv
targetEl.appendChild(countText);
targetEl.appendChild(countSpan);
}
this.rowsCounterDiv = tf_Id( this.prfxCounter+this.id );
this.rowsCounterSpan = tf_Id( this.prfxTotRows+this.id );
this.RefreshNbRows();
}
TF.prototype.RemoveRowsCounter = function()
/*====================================================
- Removes rows counter label
=====================================================*/
{
if(!this.hasGrid) return;
if( this.rowsCounterSpan==null ) return;
if(this.rowsCounterTgtId==null && this.rowsCounterDiv)
{
//IE only: clears all for sure
if(tf_isIE) this.rowsCounterDiv.outerHTML = '';
else
this.rowsCounterDiv.parentNode.removeChild(
this.rowsCounterDiv
);
} else {
tf_Id( this.rowsCounterTgtId ).innerHTML = '';
}
this.rowsCounterSpan = null;
this.rowsCounterDiv = null;
}
TF.prototype.RefreshNbRows = function(p)
/*====================================================
- Shows total number of filtered rows
=====================================================*/
{
if(this.rowsCounterSpan == null) return;
if(this.onBeforeRefreshCounter) this.onBeforeRefreshCounter.call(null, this, this.rowsCounterSpan);
var totTxt;
if(!this.paging)
{
if(p!=undefined && p!='') totTxt=p;
else totTxt = (this.nbFilterableRows - this.nbHiddenRows - (this.hasVisibleRows ? this.visibleRows.length : 0) );
} else {
var paging_start_row = parseInt(this.startPagingRow)+((this.nbVisibleRows>0) ? 1 : 0);//paging start row
var paging_end_row = (paging_start_row+this.pagingLength)-1 <= this.nbVisibleRows
? (paging_start_row+this.pagingLength)-1 : this.nbVisibleRows;
totTxt = paging_start_row+ this.fromToTextSeparator +paging_end_row+ this.overText +this.nbVisibleRows;
}
this.rowsCounterSpan.innerHTML = totTxt;
if(this.onAfterRefreshCounter) this.onAfterRefreshCounter.call(null, this, this.rowsCounterSpan, totTxt);
}

View file

@ -1 +1,58 @@
TF.prototype.SetSort=function(){var e=this.Evt._EnableSort;if(!tf_IsFn(e)){var t=this;this.Evt._EnableSort=function(){if(t.isSortEnabled&&!t.gridLayout)return;tf_IsImported(t.sortConfig.adapterSrc)?t.sortConfig.initialize.call(null,t):t.IncludeFile(t.sortConfig.name+"_adapter",t.sortConfig.adapterSrc,function(){t.sortConfig.initialize.call(null,t)})}}tf_IsImported(this.sortConfig.src)?this.Evt._EnableSort():this.IncludeFile(this.sortConfig.name,this.sortConfig.src,this.Evt._EnableSort)},TF.prototype.RemoveSort=function(){if(!this.sort)return;this.sort=!1},TF.prototype.Sort=function(){this.EvtManager(this.Evt.name.sort)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Sort feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetSort = function()
/*====================================================
- Sets sorting feature by loading
WebFX Sortable Table 1.12 by Erik Arvidsson
and TF adapter by Max Guglielmi
=====================================================*/
{
var fn = this.Evt._EnableSort;
if(!tf_IsFn(fn)){
var o = this;
this.Evt._EnableSort = function()
/*====================================================
- enables table sorting
=====================================================*/
{
if(o.isSortEnabled && !o.gridLayout) return; //gridLayout needs sort to be re-enabled
if(tf_IsImported(o.sortConfig.adapterSrc))
o.sortConfig.initialize.call(null,o);
else
o.IncludeFile(
o.sortConfig.name+'_adapter',
o.sortConfig.adapterSrc,
function(){ o.sortConfig.initialize.call(null,o); }
);
}
}
if(tf_IsImported(this.sortConfig.src))
this.Evt._EnableSort();
else
this.IncludeFile(
this.sortConfig.name,
this.sortConfig.src,
this.Evt._EnableSort
);
}
TF.prototype.RemoveSort = function()
/*====================================================
- removes sorting feature
=====================================================*/
{
if(!this.sort) return;
this.sort = false;
//this.isSortEnabled = false;
}
TF.prototype.Sort = function()
{
this.EvtManager(this.Evt.name.sort);
}

View file

@ -1 +1,110 @@
TF.prototype.SetStatusBar=function(){if(!this.hasGrid&&!this.isFirstLoad)return;var e=this.fObj;this.statusBarTgtId=e.status_bar_target_id!=undefined?e.status_bar_target_id:null,this.statusBarDiv=null,this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarText=e.status_bar_text!=undefined?e.status_bar_text:"",this.statusBarCssClass=e.status_bar_css_class!=undefined?e.status_bar_css_class:"status",this.statusBarCloseDelay=250;var t=tf_CreateElm("div",["id",this.prfxStatus+this.id]);t.className=this.statusBarCssClass;var n=tf_CreateElm("span",["id",this.prfxStatusSpan+this.id]),r=tf_CreateElm("span",["id",this.prfxStatusTxt+this.id]);r.appendChild(tf_CreateText(this.statusBarText)),this.onBeforeShowMsg=tf_IsFn(e.on_before_show_msg)?e.on_before_show_msg:null,this.onAfterShowMsg=tf_IsFn(e.on_after_show_msg)?e.on_after_show_msg:null,this.statusBarTgtId==null&&this.SetTopDiv();var i=this.statusBarTgtId==null?this.lDiv:tf_Id(this.statusBarTgtId);this.statusBarDiv&&tf_isIE&&(this.statusBarDiv.outerHTML=""),this.statusBarTgtId==null?(t.appendChild(r),t.appendChild(n),i.appendChild(t)):(i.appendChild(r),i.appendChild(n)),this.statusBarDiv=tf_Id(this.prfxStatus+this.id),this.statusBarSpan=tf_Id(this.prfxStatusSpan+this.id),this.statusBarSpanText=tf_Id(this.prfxStatusTxt+this.id)},TF.prototype.RemoveStatusBar=function(){if(!this.hasGrid)return;this.statusBarDiv&&(this.statusBarDiv.innerHTML="",this.statusBarDiv.parentNode.removeChild(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null)},TF.prototype.StatusMsg=function(e){e==undefined&&this.StatusMsg(""),this.status&&this.WinStatusMsg(e),this.statusBar&&this.StatusBarMsg(e)},TF.prototype.WinStatusMsg=function(e){if(!this.status)return;this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,e),window.status=e,this.onAfterShowMsg&&this.onAfterShowMsg.call(null,this,e)},TF.prototype.StatusBarMsg=function(e){function n(){t.statusBarSpan.innerHTML=e,t.onAfterShowMsg&&t.onAfterShowMsg.call(null,t,e)}if(!this.statusBar||!this.statusBarSpan)return;this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this,e);var t=this,r=e==""?this.statusBarCloseDelay:1;window.setTimeout(n,r)};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Status bar feature v1.2
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetStatusBar = function()
/*====================================================
- Generates status bar label
=====================================================*/
{
if(!this.hasGrid && !this.isFirstLoad) return;
var f = this.fObj;
this.statusBarTgtId = f.status_bar_target_id!=undefined //id of custom container element
? f.status_bar_target_id : null;
this.statusBarDiv = null; //element containing status bar label
this.statusBarSpan = null; //status bar
this.statusBarSpanText = null; //status bar label
this.statusBarText = f.status_bar_text!=undefined
? f.status_bar_text : ''; //defines status bar text
this.statusBarCssClass = f.status_bar_css_class!=undefined //defines css class status bar
? f.status_bar_css_class : 'status';
this.statusBarCloseDelay = 250; //delay for status bar clearing
var statusDiv = tf_CreateElm( 'div',['id',this.prfxStatus+this.id] ); //status bar container
statusDiv.className = this.statusBarCssClass;
var statusSpan = tf_CreateElm( 'span',['id',this.prfxStatusSpan+this.id] ); //status bar label
var statusSpanText = tf_CreateElm( 'span',['id',this.prfxStatusTxt+this.id] );//preceding text
statusSpanText.appendChild( tf_CreateText(this.statusBarText) );
this.onBeforeShowMsg = tf_IsFn(f.on_before_show_msg) ? f.on_before_show_msg : null; //calls function before message is displayed
this.onAfterShowMsg = tf_IsFn(f.on_after_show_msg) ? f.on_after_show_msg : null; //calls function after message is displayed
// target element container
if(this.statusBarTgtId==null) this.SetTopDiv();
var targetEl = ( this.statusBarTgtId==null ) ? this.lDiv : tf_Id( this.statusBarTgtId );
if(this.statusBarDiv && tf_isIE)
this.statusBarDiv.outerHTML = '';
if( this.statusBarTgtId==null )
{//default container: 'lDiv'
statusDiv.appendChild(statusSpanText);
statusDiv.appendChild(statusSpan);
targetEl.appendChild(statusDiv);
}
else
{// custom container, no need to append statusDiv
targetEl.appendChild(statusSpanText);
targetEl.appendChild(statusSpan);
}
this.statusBarDiv = tf_Id( this.prfxStatus+this.id );
this.statusBarSpan = tf_Id( this.prfxStatusSpan+this.id );
this.statusBarSpanText = tf_Id( this.prfxStatusTxt+this.id );
}
TF.prototype.RemoveStatusBar = function()
/*====================================================
- Removes status bar div
=====================================================*/
{
if(!this.hasGrid) return;
if(this.statusBarDiv)
{
this.statusBarDiv.innerHTML = '';
this.statusBarDiv.parentNode.removeChild(
this.statusBarDiv
);
this.statusBarSpan = null;
this.statusBarSpanText = null;
this.statusBarDiv = null;
}
}
TF.prototype.StatusMsg = function(t)
/*====================================================
- sets status messages
=====================================================*/
{
if(t==undefined) this.StatusMsg('');
if(this.status) this.WinStatusMsg(t);
if(this.statusBar) this.StatusBarMsg(t);
}
TF.prototype.WinStatusMsg = function(t)
/*====================================================
- sets window status messages
=====================================================*/
{
if(!this.status) return;
if(this.onBeforeShowMsg){ this.onBeforeShowMsg.call(null, this, t); }
window.status = t;
if(this.onAfterShowMsg){ this.onAfterShowMsg.call(null, this, t); }
}
TF.prototype.StatusBarMsg = function(t)
/*====================================================
- sets status bar messages
=====================================================*/
{
if(!this.statusBar || !this.statusBarSpan) return;
if(this.onBeforeShowMsg){ this.onBeforeShowMsg.call(null, this, t); }
var o = this;
function setMsg(){
o.statusBarSpan.innerHTML = t;
if(o.onAfterShowMsg){ o.onAfterShowMsg.call(null, o, t); }
}
var d = (t=='') ? (this.statusBarCloseDelay) : 1;
window.setTimeout(setMsg,d);
}

View file

@ -1 +1,81 @@
TF.prototype.LoadThemes=function(){this.EvtManager(this.Evt.name.loadthemes)},TF.prototype._LoadThemes=function(){if(!this.hasThemes)return;if(!this.Thm){var e=this;this.Thm={list:{},add:function(t,n,r,i){var s=r.split("/")[r.split("/").length-1],o=new RegExp(s),u=r.replace(o,"");e.Thm.list[t]={name:t,description:n,file:s,path:u,callback:i}}}}this.enableDefaultTheme&&(this.themes={name:["DefaultTheme"],src:[this.themesPath+"Default/TF_Default.css"],description:["Default Theme"]},this.Thm.add("DefaultTheme",this.themesPath+"Default/TF_Default.css","Default Theme"));if(tf_IsArray(this.themes.name)&&tf_IsArray(this.themes.src)){var t=this.themes;for(var n=0;n<t.name.length;n++){var r=t.src[n],i=t.name[n],s=t.initialize&&t.initialize[n]?t.initialize[n]:null,o=t.description&&t.description[n]?t.description[n]:null;this.Thm.add(i,o,r,s),tf_IsImported(r,"link")||this.IncludeFile(i,r,null,"link"),tf_IsFn(s)&&s.call(null,this)}}var u=this.fObj;u.btn_reset_text=null,u.btn_reset_html='<input type="button" value="" class="'+this.btnResetCssClass+'" title="Clear filters" />',u.btn_prev_page_html='<input type="button" value="" class="'+this.btnPageCssClass+' previousPage" title="Previous page" />',u.btn_next_page_html='<input type="button" value="" class="'+this.btnPageCssClass+' nextPage" title="Next page" />',u.btn_first_page_html='<input type="button" value="" class="'+this.btnPageCssClass+' firstPage" title="First page" />',u.btn_last_page_html='<input type="button" value="" class="'+this.btnPageCssClass+' lastPage" title="Last page" />',u.loader=!0,u.loader_html='<div class="defaultLoader"></div>',u.loader_text=null};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Themes loading feature v1.2
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.LoadThemes = function()
{
this.EvtManager(this.Evt.name.loadthemes);
}
TF.prototype._LoadThemes = function()
/*====================================================
- loads TF themes
=====================================================*/
{
if(!this.hasThemes) return;
if(!this.Thm){
/*** TF themes ***/
var o = this;
this.Thm = {
list: {},
add: function(thmName, thmDesc, thmPath, thmCallBack)
{
var file = thmPath.split('/')[thmPath.split('/').length-1];
var re = new RegExp(file);
var path = thmPath.replace(re,'');
o.Thm.list[thmName] = {
name: thmName,
description: thmDesc,
file: file,
path: path,
callback: thmCallBack
};
}
};
}
if(this.enableDefaultTheme){//Default theme config
this.themes = {
name:['DefaultTheme'],
src:[this.themesPath+'Default/TF_Default.css'],
description:['Default Theme']
};
this.Thm.add('DefaultTheme', this.themesPath+'Default/TF_Default.css', 'Default Theme');
}
if(tf_IsArray(this.themes.name) && tf_IsArray(this.themes.src)){
var thm = this.themes;
for(var i=0; i<thm.name.length; i++){
var thmPath = thm.src[i];
var thmName = thm.name[i];
var thmInit = (thm.initialize && thm.initialize[i]) ? thm.initialize[i] : null;
var thmDesc = (thm.description && thm.description[i] ) ? thm.description[i] : null;
//Registers theme
this.Thm.add(thmName, thmDesc, thmPath, thmInit);
if(!tf_IsImported(thmPath,'link'))
this.IncludeFile(thmName, thmPath, null, 'link');
if(tf_IsFn(thmInit)) thmInit.call(null,this);
}
}
//Some elements need to be overriden for theme
var f =this.fObj;
//Reset button
f.btn_reset_text = null;
f.btn_reset_html = '<input type="button" value="" class="'+this.btnResetCssClass+'" title="Clear filters" />';
//Paging buttons
f.btn_prev_page_html = '<input type="button" value="" class="'+this.btnPageCssClass+' previousPage" title="Previous page" />';
f.btn_next_page_html = '<input type="button" value="" class="'+this.btnPageCssClass+' nextPage" title="Next page" />';
f.btn_first_page_html = '<input type="button" value="" class="'+this.btnPageCssClass+' firstPage" title="First page" />';
f.btn_last_page_html = '<input type="button" value="" class="'+this.btnPageCssClass+' lastPage" title="Last page" />';
//Loader
f.loader = true;
f.loader_html = '<div class="defaultLoader"></div>';
f.loader_text = null;
}

View file

@ -1 +1,27 @@
TF.prototype.SetWatermark=function(e){if(!this.fltGrid)return;if(this.inpWatermark!=""){var e=e||e==undefined?!0:!1;for(var t=0;t<this.fltIds.length;t++){if(this["col"+t]!=this.fltTypeInp)continue;var n=this.isInpWatermarkArray?this.inpWatermark[t]:this.inpWatermark;this.GetFilterValue(t)==(e?"":n)&&(this.SetFilterValue(t,e?n:""),tf_AddClass(this.GetFilterElement(t),this.inpWatermarkCssClass))}}};
/*------------------------------------------------------------------------
- HTML Table Filter Generator
- Watermark feature v1.0
- By Max Guglielmi (tablefilter.free.fr)
- Licensed under the MIT License
-------------------------------------------------------------------------*/
TF.prototype.SetWatermark = function(set)
/*====================================================
- inserts or removes input watermark
- Params:
- set: if true inserts watermark (boolean)
=====================================================*/
{
if( !this.fltGrid ) return;
if(this.inpWatermark!=''){ //Not necessary if empty
var set = (set || set==undefined) ? true : false;
for(var i=0; i<this.fltIds.length; i++){
if(this['col'+i]!=this.fltTypeInp) continue; //only input type filters
var inpWatermark = (!this.isInpWatermarkArray ? this.inpWatermark : this.inpWatermark[i]);
if(this.GetFilterValue(i) == (set ? '' : inpWatermark)){
this.SetFilterValue(i,(!set ? '' : inpWatermark));
tf_AddClass(this.GetFilterElement(i), this.inpWatermarkCssClass);
}
}
}
}

2
dist/filtergrid.css vendored
View file

@ -1,6 +1,6 @@
/*------------------------------------------------------------------------
- TableFilter stylesheet by Max Guglielmi
- (build date: Fri Mar 06 2015 20:09:44)
- (build date: Sat Mar 07 2015 22:12:50)
- Edit below for your projects' needs
------------------------------------------------------------------------*/

4758
dist/tablefilter.js vendored

File diff suppressed because one or more lines are too long

View file

@ -93,6 +93,10 @@
remember_grid_values: true,
btn_reset: true,
grid_layout: false,
sort: true,
sort_config: {
sort_types: ['string','string','number','number','number']
},
rows_always_visible: [totRowIndex],
col_operation: {

View file

@ -41,7 +41,7 @@ var global = window,
doc = global.document;
export class TableFilter{
export default class TableFilter{
/**
* TF object constructor
@ -1626,10 +1626,11 @@ export class TableFilter{
=====================================================*/
setSort(){
var fn = this.Evt._EnableSort,
sortConfig = this.sortConfig;
sortConfig = this.sortConfig,
o = this;
if(!types.isFn(fn)){
var o = this;
/*====================================================
- enables table sorting
=====================================================*/
@ -1648,21 +1649,35 @@ export class TableFilter{
// function(){ sortConfig.initialize.call(null, o); }
// );
// }
// define(
// 'extensions/sortabletable/adapterSortabletable',
// function(){}
// );
var AdapterSortableTable = require(
['extensions/sortabletable/adapterSortabletable'],
function(adapterSortabletable){
console.log(adapterSortabletable);
o.Extensions.sort = new adapterSortabletable(o);
o.Extensions.sort.init();
});
};
}
if(this.isImported(this.sortConfig.src)){
this.Evt._EnableSort();
function loadSortableTable(){console.log('loadSortable');
if(o.isImported(sortConfig.src)){
o.Evt._EnableSort();
} else {
o.includeFile(
sortConfig.name, sortConfig.src, o.Evt._EnableSort);
}
}
// Import require.js if required for production environment
if(o.isImported('require.js')){
loadSortableTable();
} else {
this.includeFile(
sortConfig.name, sortConfig.src, this.Evt._EnableSort);
o.includeFile(
'tf-requirejs', o.basePath + 'require.js', loadSortableTable);
}
}

File diff suppressed because one or more lines are too long