JavaScripTools Manual


Column properties

Each Column instance has 2 read-only properties: table (containing the JavaScripTable instance that contains the column) and index (the index inside the table). They are set after adding the column to the table. Also, it is important to note the header property, that reflects the header text. Also, sorting may be disabled by setting sortable to false.

When the table is in client side mode, it is important to set the type property to one of these constants: JST_TYPE_STRING, JST_TYPE_NUMERIC, JST_TYPE_CURRENCY, JST_TYPE_DATE or JST_TYPE_BOOLEAN. This is need to compute the right sorting. The default is JST_TYPE_STRING.

The style may be customized using:

Cell functions may be used to allow a custom function to be executed when the user clicks on the cell text. This is done by the cellFunction property. It should be set to a function reference that receives the row identifier, the column index and the table reference.

Editing columns

A column may be edited by setting editable to true. In that case, the column must have an EditControl instance set on the editControl property. The control has the following properties:

Editable cells may be validated after editing by using the validateFunction property, setting it to a function that receives the cell value, the column instance and the row instance. Returning a boolean value means valid or not. Returning a string means invalid, and the string being a message to show. Also, the allowEmptyValue property determines if empty values are accepted or not.

It is possible to use InputMask, NumberMask, DateMask or SizeLimit for each control by setting the column getMaskFunction to a function instance that receives the control instance, the column instance and the row instance. It should return an instance of those masks, for example:

var column = table.addColumn(...);
column.editable = true;
column.getMaskFunction = function (control) {
    return new InputMask("####/##", control);

Manipulating the table
Table of Contents Next:
Row properties