Documentation

Utility Functions

Method Description Remarks Example
setEditTable( id, startRow, config )

Calls EditTable constructor and returns the EditTable object:

  • id: table id (string)
  • startRow (optional): index of the first row from which row selection can start (number)
  • config (optional): configuration object (literal object)
  var et = setEditTable('myTableId', 2, { editable: true });
Get(id)

this is a document.getElementById() shortcut:

  • id: id of the element (string)
  var myElm = et.Get('myId');
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 = et.Tag(document, 'table');
GetText(n)

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

  • n: node (DOM element)
  var tableText = et.GetText( et.Tag(document,'table' )[0]);
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 = et.CreateElm( 'input', ['id','myId'], ['value','Hello world'] );
CreateText(t)

this is just a document.createTextNode shortcut:

  • t: text to generate (string)
  var myText = et.CreateText( 'Hello world' );
IsArray(obj)

checks if passed param is an array. It returns a boolean

  alert(et.IsArray([1,2,3]));
IsObj(obj)

checks if passed param is an object. It returns a boolean

  alert(et.IsObj({ text: 'hello'}));
IsFn(fn)

checks if passed param is a function. It returns a boolean

  alert(et.IsFn(function(){ var a=0; }));