iTable

A table is loaded via ajax and is made sortable

Usage

Works with any table

Parameters

containerId of the table container.
minColsMinimum number of cols for a row (else we skip this row)
atFirstSortByBy default, sort by this col
ascClassHelper class for <th/> (can help the creation of arrows or something like this)
dscClassHelper class for <th/>
selectedClassClass for the selected row
oddClassOdd class to create stripes
evenClassEven class to creaste stripes

Example

In the <head> of the html file

<link media="screen" rel="stylesheet" href="css/itable.css" type="text/css"/>
<script src="js/mootools.js" type="text/javascript"></script>
<script src="js/itable.js" type="text/javascript"></script>

1: Simply make a sortable table (which is in ‘idOfTheContainer’)

<script type="text/javascript">
window.addEvent("domready", function() {
new iTable('idOfTheContainer', {tableClass:'border'});
});
</script>

2: If you wish to get the table via ajax

<script type="text/javascript">
window.addEvent("domready", function() {
var myAjax = new Ajax('url/of/the.table', {
method: 'get',
onComplete : function(){new iTable('idOfTheContainer')}.bind(this),
update: 'idOfTheContainer'
}).request();
});
</script>

Require

Core

* Core.js

Class

* Class.js
* Class.Extras.js

Native

* Array.js
* String.js
* Function.js
* Number.js
* Element.js

Element

* Element.Filters.js
* Element.Selectors.js
* Element.Form.js

Remote

* XHR.js
* Ajax.js

About

formcheck.js v.1.0 for mootools v1.1 05 / 2007

by Floor SA (http://www.floor.ch) MIT-style license

Created by Luca Pillonel and David Mignot, last modified by Luca Pillonel 30.05.12

Todo

Class simplify on th -> simplify this cols.  Possibility to do others usefull things (class=”currency chf” 3.03 -> 3.50 chf)

Summary
A table is loaded via ajax and is made sortable
Constructor
Internal method
Internal method
Internal method
Internal method
Internal method

Functions

initialize

initialize: function(container,
options)

Constructor

Set the options and start the ajaxRequest

tablePrep

Internal method

Prepare the table

Parameters

coID of the result container

constructTable

Internal method

Create a new table from the original one

sortBy

sortBy: function(n)

Internal method

Parameters

nColumn number

comPare

comPare: function(a,
b)

Internal method

Parameters

a, bThe element to compare (passed by default on a “array.sort()”

simplify

Internal method

Parameters

numberA number to simplify. ex: 12.38442 -> 12.38
initialize: function(container,
options)
Constructor
sortBy: function(n)
Internal method
comPare: function(a,
b)
Internal method