1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-13 20:06:59 +02:00

Clening up tabs

This commit is contained in:
koalyptus 2014-09-17 23:12:31 +00:00
parent f22e0f1a62
commit f484b2d64a

View file

@ -56,31 +56,32 @@ var TF = (function() {
if(this.tbl !== null && this.tbl.nodeName.tf_LCase() === 'table' && if(this.tbl !== null && this.tbl.nodeName.tf_LCase() === 'table' &&
this.GetRowsNb() > 0){ this.GetRowsNb() > 0){
if(arguments.length>1) if(arguments.length>1){
{
for(var i=0; i<arguments.length; i++) for(var i=0; i<arguments.length; i++)
{ {
var argtype = typeof arguments[i]; var arg = arguments[i];
var argtype = typeof arg;
switch(argtype.tf_LCase()) switch(argtype.tf_LCase())
{ {
case 'number': case 'number':
this.startRow = arguments[i]; this.startRow = arg;
break; break;
case 'object': case 'object':
this.fObj = arguments[i]; this.fObj = arg;
break; break;
}//switch }
}//for }
}//if }
var f = !this.fObj ? {} : this.fObj; var f = !this.fObj ? {} : this.fObj;
//Start row et cols nb //Start row et cols nb
this.refRow = this.startRow==undefined ? 2 : (this.startRow+1); this.refRow = this.startRow===undefined ? 2 : (this.startRow+1);
try{ this.nbCells = this.GetCellsNb(this.refRow) } try{ this.nbCells = this.GetCellsNb(this.refRow) }
catch(e){ this.nbCells = this.GetCellsNb(0) } catch(e){ this.nbCells = this.GetCellsNb(0) }
this.basePath = f.base_path!=undefined ? f.base_path : 'TableFilter/'; //default script base path //default script base path
this.basePath = f.base_path!=undefined ? f.base_path : 'TableFilter/';
/*** filter types ***/ /*** filter types ***/
this.fltTypeInp = 'input'; this.fltTypeInp = 'input';
@ -104,13 +105,16 @@ var TF = (function() {
this.fltGrid = f.grid==false ? false : true; //enables/disables filter grid this.fltGrid = f.grid==false ? false : true; //enables/disables filter grid
/*** Grid layout ***/ /*** Grid layout ***/
this.gridLayout = f.grid_layout ? true : false; //enables/disables grid layout (fixed headers) //enables/disables grid layout (fixed headers)
this.hasGridWidthsRow = false; //flag indicating if the grid has an additional row for column widths (IE<=7) this.gridLayout = f.grid_layout ? true : false;
//flag indicating if the grid has an additional row for column widths (IE<=7)
this.hasGridWidthsRow = false;
this.gridColElms = []; this.gridColElms = [];
this.sourceTblHtml = null; this.sourceTblHtml = null;
if(this.gridLayout){ if(this.gridLayout){
if(this.tbl.outerHTML==undefined) tf_SetOuterHtml(); //Firefox does not support outerHTML property... //Firefox does not support outerHTML property...
this.sourceTblHtml = this.tbl.outerHTML; //original table html if(this.tbl.outerHTML==undefined) tf_SetOuterHtml();
this.sourceTblHtml = this.tbl.outerHTML;
} }
/*** ***/ /*** ***/
this.filtersRowIndex = f.filters_row_index!=undefined ? f.filters_row_index : 0; this.filtersRowIndex = f.filters_row_index!=undefined ? f.filters_row_index : 0;
@ -119,8 +123,11 @@ var TF = (function() {
if(this.headersRow>1) this.filtersRowIndex = this.headersRow+1; if(this.headersRow>1) this.filtersRowIndex = this.headersRow+1;
else{ this.filtersRowIndex = 1; this.headersRow = 0; } else{ this.filtersRowIndex = 1; this.headersRow = 0; }
} }
this.fltCellTag = f.filters_cell_tag!=undefined //defines tag of the cells containing filters (td/th)
//defines tag of the cells containing filters (td/th)
this.fltCellTag = f.filters_cell_tag!=undefined
? (f.filters_cell_tag!='th' ? 'td' : 'th') : 'td'; ? (f.filters_cell_tag!='th' ? 'td' : 'th') : 'td';
this.fltIds = []; //stores filters ids this.fltIds = []; //stores filters ids
this.fltElms = []; //stores filters DOM elements this.fltElms = []; //stores filters DOM elements
this.searchArgs = null; //stores filters values this.searchArgs = null; //stores filters values
@ -133,21 +140,29 @@ var TF = (function() {
this.rDiv = null; //div for reset button and results per page select this.rDiv = null; //div for reset button and results per page select
this.mDiv = null; //div for paging elements this.mDiv = null; //div for paging elements
this.contDiv = null; //table container div for fixed headers (IE only) this.contDiv = null; //table container div for fixed headers (IE only)
this.infDivCssClass = f.inf_div_css_class!=undefined //defines css class for div containing
? f.inf_div_css_class : 'inf'; //paging elements, rows counter etc. //defines css class for div containing paging elements, rows counter etc.
this.lDivCssClass = f.left_div_css_class!=undefined //defines css class for left div this.infDivCssClass = f.inf_div_css_class!=undefined
? f.inf_div_css_class : 'inf';
//defines css class for left div
this.lDivCssClass = f.left_div_css_class!=undefined
? f.left_div_css_class : 'ldiv'; ? f.left_div_css_class : 'ldiv';
this.rDivCssClass = f.right_div_css_class!=undefined //defines css class for right div //defines css class for right div
this.rDivCssClass = f.right_div_css_class!=undefined
? f.right_div_css_class : 'rdiv'; ? f.right_div_css_class : 'rdiv';
this.mDivCssClass = f.middle_div_css_class!=undefined //defines css class for mid div //defines css class for mid div
this.mDivCssClass = f.middle_div_css_class!=undefined
? f.middle_div_css_class : 'mdiv'; ? f.middle_div_css_class : 'mdiv';
//table container div css class
this.contDivCssClass = f.content_div_css_class!=undefined this.contDivCssClass = f.content_div_css_class!=undefined
? f.content_div_css_class : 'cont'; //table container div css class ? f.content_div_css_class : 'cont';
/*** filters' grid appearance ***/ /*** filters' grid appearance ***/
this.stylesheet = f.stylesheet!=undefined ? f.stylesheet : this.basePath+'filtergrid.css'; //stylesheet file //stylesheet file
this.stylesheet = f.stylesheet!=undefined ? f.stylesheet : this.basePath+'filtergrid.css';
this.stylesheetId = this.id + '_style'; this.stylesheetId = this.id + '_style';
this.fltsRowCssClass = f.flts_row_css_class!=undefined //defines css class for filters row //defines css class for filters row
this.fltsRowCssClass = f.flts_row_css_class!=undefined
? f.flts_row_css_class : 'fltrow'; ? f.flts_row_css_class : 'fltrow';
this.enableIcons = f.enable_icons!=undefined ? f.enable_icons : true; //enables/disables icons (paging, reset button) this.enableIcons = f.enable_icons!=undefined ? f.enable_icons : true; //enables/disables icons (paging, reset button)
this.alternateBgs = f.alternate_rows ? true : false; //enables/disbles rows alternating bg colors this.alternateBgs = f.alternate_rows ? true : false; //enables/disbles rows alternating bg colors