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'});

this is a document.getElementById() shortcut:

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

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');

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

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

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'] );

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);

escapes special characters:

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

checks if passed param is an array:

  • varname: variable name (string)

It returns a boolean


checks if var exists and is an object:

  • varname: variable name (string)

It returns a boolean


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!