/*------------------------------------------------------------------------
- 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
'');
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:
' +
'<, <=, >, >=, =, *, !, {, }, ||, ' +
'&&, [empty], [nonempty], rgx:
These operators are described here:
' +
'http://tablefilter.free.fr/#operators