Documentation

HTML Table Filter Generator is no longer maintained, it is now replaced by the TableFilter project. Don't hesitate to check the demos out in their new location along with exhaustive documentation in the project's WIKI.

Utility Functions

Method Description Remarks Example
setFilterGrid(id, refRowIndex, configObj)

generates the column filters grid and returns the TF object:

  • id: table id (string)
  • refRowIndex (optional): reference row index (number)
  • configObj (optional): configuration object (literal object)
  var tf = setFilterGrid('myTableId', 2, {col_0: 'select'});
tf_Id(id)

this is a document.getElementById() shortcut:

  • id: id of the element (string)
  var myElm = tf_Id('myId');
tf_Tag(o,tagname)

this is just a getElementsByTagName() shortcut:

  • o: target element (DOM element)
  • tagname: tag to search for (string)

It returns an array

  var myTables = tf_Tag(document, 'table');
tf_GetNodeText(n)

returns the text of given a node and its child nodes:

  • n: node (DOM element)
  var tableText = tf_GetNodeText( tf_Tag(document,'table' )[0]);
tf_CreateElm(tag)

creates an html element with defined attributes:

  • the html tag to create (string)
  • an unlimited # of arrays defining the attributes values ('attribute name','value' ['id','myId'])
  var myInput = tf_CreateElm( 'input', ['id','myId'], ['value','Hello world'] );
tf_CreateText(t)

this is just a document.createTextNode shortcut:

  • t: text to generate (string)
  var myText = tf_CreateText( 'Hello world' );
tf_CreateOpt(text, value ,isSel)

creates an option element and returns it:

  • text: option's text (string)
  • value: option's value (string)
  • isSel: selected option (boolean)
  var myOption = tf_CreateOpt('Value 01', '01', false);
tf_RegexpEscape(s)

escapes special characters:

  • s: text to escape
  alert( tf_RegexpEscape( '^$[Hello world!\]' ) );
tf_IsArray(obj)

checks if passed param is an array:

  • varname: variable name (string)

It returns a boolean

  alert(tf_IsArray([1,2,3]));
tf_IsObj(varname)

checks if var exists and is an object:

  • varname: variable name (string)

It returns a boolean

  alert(tf_IsObj('myVar'));
tf_IsFn(fn)

checks if passed param is a function:

  • fn: a function

It returns a boolean

  alert(tf_IsFn(function(){ var a=0; }));
tf_isValidDate(dateStr, format)

checks if passed date string has a valid date format:

  • dateStr: date (string)
  • format: 'DMY', 'MDY', 'YMD'

It returns a boolean

  alert( tf_isValidDate('21-7-09', 'DMY') );
tf_formatDate(dateStr, format)

returns a date object for a given date string and format:

  • dateStr: date (string)
  • format: 'DMY', 'MDY', 'YMD'
  var myDate = tf_formatDate('21-7-09', 'YMD');
tf_removeNbFormat(data, format)

cleans a formated number and returns it:

  • data: formated number (1,253.77 vs 1.253,77)
  • format: 'US', 'EU'

It returns a number

  alert( tf_removeNbFormat('1.253,77', 'eu') );

E.n.j.o.y.  ads-free content!