ColumnList

The class that represents a column list.
All indexes are zero based.

Syntax

new ColumnList();

Parameters

Static Methods

NameDescription
None.

Static Fields

NameTypeDescripton
None.

Methods

NameDescription
addRow

Syntax

object.addRow(aRowData)

Arguments

NameTypeDescripton
aRowDataString[]Array containing data for the new row. Each element represents a cell.

Return Type

iErrorCode

Appends supplied row to the column list.
addRows

Syntax

object.addRows(aData)

Arguments

NameTypeDescripton
aDataString[][]Two dimensional array containing the data. The first dimension specifies the row and the second the column, thus each element represents a cell.

Return Type

iErrorCode

Appends supplied rows to the column list.
bind

Syntax

object.bind(eCont, eHead, eBody)

Arguments

NameTypeDescripton
eContHTML ElementThe outer container.
eHeadHTML ElementContainer with the column list header.
eBodyHTML ElementContainer with the column list body.

Return Type

MenuItem

Binds column list to an existing HTML structure. See the usage instructions for further information.
calcSize

Syntax

object.calcSize()

Arguments

No Arguments.

Return Type

void

Recalculates the size of the column list widget. Should be called if the size of the outermost container is changed.
clear

Syntax

object.clear()

Arguments

NameTypeDescripton

Return Type

iErrorCode

Removes all rows from column list.
create

Syntax

object.create(eContent, aColumns, aColumns)

Arguments

NameTypeDescripton
eContentHTML ElementThe target container which the column list will be based upon.
aColumnsString[]Array containing the desired column names.
aColumns[][]Optionallt a two dimensional array can be specified instead for the aColumns parameter. In that case the first child element is the column header, the second the width (number and unit, ex '30%') and the third the data type, see setColumnTypes for values.

Return Type

iErrorCode

Transforms the supplied container into an empty column list.
getCellValue

Syntax

object.getCellValue(iRowIndex, iColIndex)

Arguments

NameTypeDescripton
iRowIndexNumberRow index.
iColIndexNumberColumn index.

Return Type

String

Returns the content of the specified cell.
getColumnCount

Syntax

object.getColumnCount()

Arguments

No Arguments.

Return Type

Number

Returns the number of columns in the column list.
getRowCount

Syntax

object.getRowCount()

Arguments

No Arguments.

Return Type

Number

Returns the number of rows in the column list.
getSelectedRange

Syntax

object.getSelectedRange()

Arguments

No Arguments.

Return Type

Number[]

Returns an array containing the row indexes of all selected rows.
getSelectedRow

Syntax

object.getSelectedRow()

Arguments

No Arguments.

Return Type

Number

Returns the row index of the selected row. If multiple rows are selected the first one is returned.
removeRange

Syntax

object.removeRange(iFromRowIndex)

Arguments

NameTypeDescripton
iFromRowIndexNumberIndex of the first row to remove.

Return Type

iErrorCode

Removes all rows in the range defined by the iFromRowIndex and iToRowIndex parameters.
removeRange

Syntax

object.removeRange(iRowIndex)

Arguments

NameTypeDescripton
iRowIndexNumber[]Array containing the row indexes to remove.

Return Type

iErrorCode

Removes all rows specified in the iRowIndex parameter.
removeRow

Syntax

object.removeRow(iRowIndex)

Arguments

NameTypeDescripton
iRowIndexNumberIndex of the row to remove.

Return Type

iErrorCode

Removes the row identified by the sequence number supplied.
resize

Syntax

object.resize(iWidth, iHeight)

Arguments

NameTypeDescripton
iWidthNumberDesired width in pixels.
iHeightNumberDesired height in pixels.

Return Type

void

Resize the grid to the given dimensions, the outer (border) size is given, not the inner (content) size.
selectRange

Syntax

object.selectRange(iFromRowIndex)

Arguments

NameTypeDescripton
iFromRowIndexNumberIndex of the first row to select.

Return Type

iErrorCode

Selects all rows in the range defined by the iFromRowIndex and iToRowIndex parameters.
selectRange

Syntax

object.selectRange(iRowIndex)

Arguments

NameTypeDescripton
iRowIndexNumber[]Array containing the row indexes to select.

Return Type

iErrorCode

Selects all rows specified in the iRowIndex parameter.
selectRow

Syntax

object.selectRow(iRowIndex)

Arguments

NameTypeDescripton
iRowIndexNumberIndex of the row to select.

Return Type

iErrorCode

Selects the row identified by the sequence number supplied.
setCellValue

Syntax

object.setCellValue(iRowIndex, iColIndex, sValue)

Arguments

NameTypeDescripton
iRowIndexNumberRow index.
iColIndexNumberColumn index.
sValueStringDesired value.

Return Type

iErrorCode

Sets the content of the specified cell.
setColumnAlignment

Syntax

object.setColumnAlignment(iAlignment)

Arguments

NameTypeDescripton
iAlignmentNumber[]An array containing the alignment types. ALIGN_AUTO, ALIGN_LEFT, ALIGN_CENTER or ALIGN_RIGHT.

Return Type

void

Sets column text alignment.
setColumnTypes

Syntax

object.setColumnTypes(iTypesTypes)

Arguments

NameTypeDescripton
iTypesTypesNumber[]An array containing the sort types. STRING, TYPE_NUMBER, TYPE_DATE, TYPE_STRING_NO_CASE or custom string value that will be passed to sortable table. Can be registered with the SortableTable.prototype.addSortType method.

Return Type

void

Sets the column data types. Used to determine alignment and sorting.
setSortTypes

Syntax

object.setSortTypes(iTypesTypes)

Arguments

NameTypeDescripton
iTypesTypesNumber[]An array containing the sort types. STRING, TYPE_NUMBER, TYPE_DATE, TYPE_STRING_NO_CASE or custom string value that will be passed to sortable table. Can be registered with the SortableTable.prototype.addSortType method.

Return Type

void

Sets the column data types. Used to determine alignment and sorting.
sort

Syntax

object.sort(iColumnIndex [, bDescending])

Arguments

NameTypeDescripton
iColumnIndexNumberIndex of column to sort by.
bDescendingBooleanOptional. Sort will be descending if true, ascending if false.. The default value is false.

Return Type

void

Sorts the column list by the specified column.

Fields

NameTypeDescripton
bodyColResizeBooleanIf enabled the size of the body columns will be updated as the header column is resized, if not the size of the body columns won't update until resize operation has completed.
colorEvenRowsBooleanIf enabled odd and even rows will have different class names (odd and even) to allow their background color to be different.
columnAlignBooleanEnable column text alignment. If enabled the text alignment of columns can be set explicitly or determined implicit based on column data type.
columnSortingBooleanEnable column sorting. If enabled sort order can be set by clicking the column headers.
errorStringRead only. If a method has returned an error code this property will contain an error message.
moveColumnsBooleanEnable column moving. If enabled columns can be reorganized using drag and drop.
multipleBooleanIf true multiple selection is allowed, if false it's not.
resizeColumnsBooleanEnable column resizing. If enabled the columns may be resized by dragging the border between two column headers.
rowSelectionBooleanEnable column selection. If enabled rows can be selected using either the mouse or keyboard.
selectedRowsNumber[]Read only. An array containing the indexes of all selected rows.
sortAscImageStringImage used to indicate ascending sort order
sortColNumberRead only. Indicates which column the column list is sorted by or -1 if it is not sorted.
sortDescendingBooleanRead only. Indicates sort direction. False for ascending, true for descending.
sortDescImageStringImage used to indicate descending sort order

Events

NameDescripton
onresizeReference to function that will be called when the widget has been resized.
onselectReference to function that will be called when a row has been selected.
onsortReference to function that will be called when a sort operation has been performed.

Remarks

None.

Introduction
Implementation
Usage
API
Demo
Download

Author: Emil A Eklund