html. table.js

Builds table elements with methods to add rows quickly.

Author

Aaron Newton <aaron [dot] newton [at] cnet [dot] com>

Dependencies

MootoolsMoo.js, <Utilities.js>, Common.js, Array.js, String.js, Element.js, Function.js
Summary
html. table.jsBuilds table elements with methods to add rows quickly.
HtmlTableBuilds table elements with methods to add rows quickly.
Properties
rowInserts a new table row.
Change Log$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/layout.widgets/html.table.js,v $ $Log: html.table.js,v $ Revision 1.3 2007/06/12 20:46:20 newtona added tbody to html.table.js added legacy argument support to Fx.SmoothShow

HtmlTable

Builds table elements with methods to add rows quickly.

Arguments

options(object) a key/value set of options

Options

propertiesa set of properties for the Table element (defaults to cellpadding: 0, cellspacing: 0, border: 0)
rows(array) an array of row objects (see <HtmlTable.push>)
Summary
Properties
rowInserts a new table row.

Properties

row

Inserts a new table row.

Arguments

row(array) the data for the row.

Row data

Row data can be in either of two formats.

simplean array of strings that will be inserted into each table data
detailedan array of objects with definitions for content and properties for each td

Example

var myTable = new HtmlTable();
myTable.push(['value 1','value 2', 'value 3']); //new row
myTable.push([
{
content: 'value 4',
properties: {
colspan: 2,
className: 'doubleWide',
style: '1px solid blue'
},
{
content: 'value 5'
}
]);

RESULT:
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>value 1</td>
<td>value 2</td>
<td>value 3</td>
</tr>
<tr>
<td colspan="2" class="doubleWide" style="1px solid blue">value 4</td>
<td>value 5</td>
</tr>
</table>

Change Log

$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/layout.widgets/html.table.js,v $ $Log: html.table.js,v $ Revision 1.3 2007/06/12 20:46:20 newtona added tbody to html.table.js added legacy argument support to Fx.SmoothShow

Revision 1.2 2007/05/17 19:45:43 newtona product picker: hide() now hides tooltips; onPick passes in a 3rd argument that is the picker stickyWinHTML: fixed a bug with className options for buttons html.table: fixed a bug with className options for buttons

Revision 1.1 2007/05/16 20:09:41 newtona adding new js files to redball.common.full product.picker.js now has no picklets; these are in the implementations/picklets directory ProductPicker now detects if there is no doctyp and, if not, sets the position of the picker to be fixed (no IE6 support) small docs update in element.cnet.js added new picklet: CNETProductPicker_PricePath added new picklet: NewsStoryPicker_Path new file: clipboard.js (allows you to insert text into the OS clipboard) new file: html.table.js (automates building html tables) new file: element.forms.js (for managing text inputs - get selected text information, insert content around selection, etc.)

My Object Oriented javascript.
Contains common implementations for custom classes.
function $A(array,
start,
length)
returns a copy of the array.
Same as Array.copy, but as function.
function $each(iterable,
fn,
bind)
Use to iterate through iterables that are not regular arrays, such as builtin getElementsByTagName calls, arguments of a function, or an object.
Contains Array prototypes, $A, $each
Contains String prototypes and Number prototypes.
function $(el)
returns the element passed in with all the Element prototypes applied.
Contains useful Element prototypes, to be used with the dollar function $.
Contains Function prototypes and utility functions .