Table

A Table UI component displays data in a structured grid of rows and columns, making it easy to read, sort, and interact with. It supports features like column resizing, column reordering, sorting, filtering, multiple data types and more.

Column object format is shown in example below. Rows are arrays of values (cells), each value for a corresponding column. Row cell data type must match the data type required for it's column type.

Constructor

new Table(textopt)

Create Table UI component.

Parameters:
NameTypeAttributesDescription
textString<optional>

Text value held by the component. It can be used as a Tab text when the Table is added to Tabs component.

Example
<h2>Format of a column object:</h2>
{
    text: string,           // (Required) The text to be displayed in the column header.
    type: string,           // Type of component to use to display/edit cell data. Here is a list of possible types:
                            //   "text" (Default) - Plain text or HTML. WARNING: Images in HTML content get loaded from source each time they are drawn, so loading images from the web is discouraged.
                            //   "password" - A masked password text field.
                            //   "textarea" - A multi-line text field.
                            //   "icon" - Image loaded from a cell value source (relative/absolute local path or URL). To receive click events register callback using table.onAction(callback); e.type will be "button".
                            //   "button" - String of button names separated by "|" character. To receive click events register callback using table.onAction(callback); e.type will be "icon".
                            //   "checkbox" - `true` and `false` value selection component using a check mark.
                            //   "combobox" - A drop down list of values. Can be editable to add custom value.
                            //   "progress" - A progress bar that visually displays an integer cell value between 0 and 100.
    sorting: Table.Sorting, // Table.Sorting.None disables sorting for the given column, other values of Table.Sorting specify the type of sorting to use. Table.Sorting.Natural is default.
    icon_size: number,      // For "icon" column type it specifies the fixed height of width of the icon (which ever is larger), resizing it while maintaining aspect ratio.
    cache_capacity: number, // For "icon" column type it specifies the amount of images cached in RAM so they don't have to be loaded from source each time they are drawn on the screen. Default is 10.
    resizable: boolean,     // Indicates whether user should be able resize the column.
    auto_resize: boolean,   // indicates if this column should be auto-resized when table is resized. Note that this is ignored when table's auto resize is set to Table.AutoResize.None.
    width: number,          // Sets a desired initial width of the column.
    min_width: number,      // Sets a minimum width that the column can be resized to.
    max_width: number,      // Sets a maximum width that the column can be resized to.
    hidden: boolean,        // When set to `true`, the column is not visible (width is 0 pixels). To show hidden column set this property to `false`. Default is `false`.
    character: string,      // For column type "password" it sets a text character to use as a masking character.
    editable: boolean,      // Sets whether text fields should be editable (usually by double clicking on them).
    clicksToEdit: boolean,  // Specifies after how many quick clicks on text editing cells they become editable (For example 1, 2, or 3). Only has affect if the column is editable.
    options: string[]       // For "combobox" type of column specifies a list of values to show in the combobox list.
}

// NOTE: When adding a new column, only "text" is required for the column, other properties are optional.

Classes

Table

Members

(readonly) AutoResize :number

Enum for table column auto-resizing modes. Used with Table#autoResizeColumns.

Type:
  • number
Properties
NameTypeDescription
Nonenumber

Do not auto-resize columns when one of the columns is resized.

NextColumnnumber

Resize the next column when current column changes.

SubsequentColumnsnumber

Resize all columns to the right of the changed column.

LastColumnnumber

Resize only the last column.

AllColumnsnumber

Resize all other columns equally to adapt to new size of a column that is being resized.

Example
Table.AutoResize.AllColumns

(readonly) GridLines :number

Enum for table grid line display modes.

Type:
  • number
Properties
NameTypeDescription
Nonenumber

No grid lines.

Horizontalnumber

Show only horizontal lines.

Verticalnumber

Show only vertical lines.

Bothnumber

Show both horizontal and vertical lines.

Example
<h2>Setting to show only horizontal grid lines:</h2>
table.gridLines(Table.GridLines.Horizontal);

(readonly) SortOrder :number

Enum for sort order.

Type:
  • number
Properties
NameTypeDescription
Nonenumber

No sorting order applied.

Ascendingnumber

Values sorted from smallest to largest.

Descendingnumber

Values sorted from largest to smallest.

Example
<h2>Sorting rows by column 2 in ascending order:</h2>
table.sortOrder(2, false, Table.SortOrder.Ascending);

(readonly) Sorting :number

Enum for column sorting modes. Used in column definitions, e.g., { sorting: Table.Sorting.Natural }.

Type:
  • number
Properties
NameTypeDescription
Nonenumber

No sorting applied.

Naturalnumber

(Default) Natural order sorting (alphanumeric).

CaseInsensitivenumber

Case-insensitive string sorting.

Integernumber

Sort values as integers.

Floatnumber

Sort values as floating-point numbers.

Example
table. Table.Sorting.Natural

(readonly) columnCount :number

Returns the amount of columns currently in the Table.

Type:
  • number

(readonly) rowCount :number

Returns a number of rows in the Table.

Type:
  • number

(readonly) selectedRows :Array.<(string|number|boolean)>

Returns an array of currently selected rows.

Type:
  • Array.<(string|number|boolean)>

Methods

addColumn(column, indexopt) → {Table}

Adds a column to a Table as a last column or at specified index. An empty data will be added at that column index for each row. For detail about column object format and all possible column properties refer to examples in the Table class description above. See usage example below.

Parameters:
NameTypeAttributesDescription
columnobject

A column Object with column properties, such as text, background color, etc.

indexnumber<optional>

Insert at this position. Index is the original position of columns that were before columns are reordered.

Returns:

Returns this Table for method chaining.

Type: 
Table
Example
// How to add a column at an index 3
table.addColumn({text: "Customer Name", header_align:"center"}, 3);

addRow(row, indexopt) → {Table}

Adds a new row at the end of table or at a specified index.

Parameters:
NameTypeAttributesDescription
rowArray.<(string|number|boolean)>

An array of cell values of the row according to each column. Missing cells will be filled with empty data.

indexnumber<optional>

Index at which to insert the row (original indexing, sorting is ignored).

Returns:

Returns an instance of this Table for method chaining.

Type: 
Table
Example
table.addRow(["John Dow", 45, true, "Charlotte, NC", "[View|Remove]"]);

autoResizeColumns(valueopt) → {Table.AutoResize|Table}

Gets or sets columns' behavior when a single column is resized (usually manually by the user). Check description of each value of Table#AutoResize on this page. See usage example below.

Parameters:
NameTypeAttributesDescription
valueTable.AutoResize<optional>

One of: Table.AutoResize.None (default), Table.AutoResize.NextColumn, Table.AutoResize.SubsequentColumns, Table.AutoResize.LastColumn, Table.AutoResize.AllColumns

Returns:

Returns current auto-resize mode if no argument is passed, otherwise the Table instance for chaining.

Type: 
Table.AutoResize | Table
Example
// disables resizing of other columns when one column is resized
table.autoResizeColumns(Table.AutoResize.None);

// last column will be resize to accommodate room for a column being resized
table.autoResizeColumns(Table.AutoResize.LastColumn);

canReorderColumns(enableopt) → {boolean|Table}

Sets or gets ability to change order of columns by dragging-dropping them by a user.

Parameters:
NameTypeAttributesDescription
enableboolean<optional>

To enable reordering pass true, to disable pass false.

Returns:

If setting a value this method returns this Table instance, when getting current value a boolean is returned.

Type: 
boolean | Table

cellAt(x, y) → {Array.<number>|null}

Gets a cell [row,column] located at specified X and Y coordinates relative to the Table's top-left corner, or null if no cell exist at specified coordinates.

Parameters:
NameTypeDescription
xnumber

X

ynumber

Y

Returns:

Returns the cell position as a x and y position, or null if the coordinates are outside any cell.

Type: 
Array.<number> | null

cellEditing(row, column, new_orderopt, editingopt) → {boolean|Table}

Sets or gets whether a cell at specified row and columns is in editing mode.

Parameters:
NameTypeAttributesDefaultDescription
rownumber

Row of the cell in question

columnnumber

Column of the cell in question

new_orderboolean<optional>
false

Specified if row and column should be interpreted as new index (after row sorting and column reordering) or not.

editingboolean<optional>

Set to true or false to set whether the cell should be in editing mode. Omit this argument to get current value.

Returns:

When editing argument is passed, an instance of this Table is returned, otherwise current value is returned as boolean.

Type: 
boolean | Table

clicksToEdit(clicksopt) → {number|Table}

Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.

Parameters:
NameTypeAttributesDescription
clicksnumber<optional>

Amount of clicks: 1, 2, or 3. Default is 2 (double-click).

Returns:

Returns the current value if no parameters are provided; otherwise, and instance of this Table is returned.

Type: 
number | Table

column(i, new_orderopt, columnopt) → {Table|object}

Retrieve a column at specified index or updates an existing column at specified index.

Parameters:
NameTypeAttributesDefaultDescription
inumber

Index of the column to retrieve or update.

new_orderboolean<optional>
false

Should the index be interpreted as a new sorted order index or original order. Default is false.

columnobject<optional>

An object of column properties to update in a column at specified index. To retrieve the column omit this argument.

Returns:

When retrieving the column a column object is returned, otherwise this Table instance is returned.

Type: 
Table | object

columnVisible(i, new_orderopt, visibleopt) → {boolean|Table}

Sets or get visibility of a column.

Parameters:
NameTypeAttributesDefaultDescription
inumber

Index of the column

new_orderboolean<optional>
false

Should the index be interpreted as a new sorted order index or original order. Default is false.

visibleboolean<optional>

true to make the column visible, false to hide it.

Returns:

If visible argument is passed, then this Table object is returned, otherwise current visibility value is returned.

Type: 
boolean | Table

columns(copt) → {Array.<Object>|Table}

Gets or sets the list of columns for the table. To simple remove all columns pass null or empty Array.

  • When passing an array of column objects, it replaces the existing columns.
  • Passing null removes all columns.
  • Passing fewer columns than currently exist will also remove the extra columns from all rows.
  • Passing a boolean will return the current columns (instead of setting them):
    • true — returns columns in their current display order.
    • false — returns columns in their original order (default).
Parameters:
NameTypeAttributesDefaultDescription
cArray.<Object> | boolean<optional>
false

Object[] of columns to set new columns and replace existing columns. null to remove all columns. boolean to get columns array. true to get columns in a new order, false (default) to get columns in original order.

Returns:
Type: 
Array.<Object> | Table

filter(filteropt) → {Table|string}

Sets row filter expression which can be a combination of conditions similar to if() condition in JavaScript.

Setting the filter hides rows that don't match specified filter criteria. When filter is set to "", filter gets cleared and all rows become visible again.

  • Filter format is in the form of IF condition: "column(index) operator comparison_value".
  • Note that a column must be specified on the left side of the condition and comparison value on the right side.
  • Conditions can be combined using AND "&&", OR "||", and parenthesis "( )".
  • Condition in parenthesis can be negated by "!" before parenthesis.
  • Valid operators are: ! ( ) < == != > && || regex.
  • comparison_value can be a number, string value, string regular expression, or boolean.

See examples below.

Parameters:
NameTypeAttributesDescription
filterstring<optional>

Filter to use to display only rows that meet the specified conditions. Default is "" (no filter).

Returns:

Returns this Table when setting filter, otherwise returns current filter.

Type: 
Table | string
Examples
// Using case insensitive regular expression
table.filter(`column(1) regex "(?i)^Jim.*"`);
// Filtering by numeric value
table.filter("column(1) < 50");
// Filtering by date
table.filter(`column(3) > "2023-04-01 00:00:00" && column(3) < "2024-05-30 00:00:00"`);
// Filtering by a boolean for checkbox
table.filter("column(4) != false");

gridColor(coloropt) → {string|Table}

Gets or sets the color of the table's grid lines. Note: This only has an effect if grid lines are enabled.

Parameters:
NameTypeAttributesDescription
colorstring<optional>

A valid CSS color string (e.g., "#000000" for black).

Returns:

Returns the current value if no parameter is provided; otherwise, returns the Table instance for chaining.

Type: 
string | Table
Example
// Set the grid line color
table.gridColor("#000000");

// Get the current grid line color
alert(table.gridColor());

gridLines(valueopt) → {Table.GridLines|Table}

Gets or sets which grid lines are visible (horizontal, vertical, both, or none).

Parameters:
NameTypeAttributesDescription
valueTable.GridLines<optional>

One of: Table.GridLines.None, Table.GridLines.Horizontal, Table.GridLines.Vertical, Table.GridLines.Both (default). See Table#GridLines.

Returns:

Returns the current value if no parameter is provided; otherwise, returns the Table instance for chaining.

Type: 
Table.GridLines | Table

headerEnabled(enableopt) → {boolean|Table}

Enables or disables Table header. When it's disabled, it doesn't respond to user's interaction.

Parameters:
NameTypeAttributesDescription
enableboolean<optional>

true to enable, false to disable.

Returns:

When setting, and instance of this Table is returned, otherwise a current value is returned.

Type: 
boolean | Table

headerSize(sizeopt) → {number|Table}

Sets or gets a size (height) of Table header. Set it to 0 to make it not visible.

Parameters:
NameTypeAttributesDescription
sizenumber<optional>

Height of table to set. Omit this argument to get current height.

Returns:

When setting, an instance of this Table is returned, otherwise a current value is returned.

Type: 
number | Table

moveColumn(from_index, to_index)

Moves a column from one position to another. Uses new column order for column indexes (if columns were reordered).

Parameters:
NameTypeDescription
from_indexnumber

Index of the column to move

to_indexnumber

New position index

onColumnEvents(callbackopt, removeopt) → {Table|Array.<function()>}

Gets, registers or unregisters a column event handler function. This event handler is called when a column is inserted, removed, resized, or moved (reordered).

Parameters:
NameTypeAttributesDefaultDescription
callbackfunction<optional>

The event handler function. Receives an event object.

removeboolean<optional>
false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: 
Table | Array.<function()>
Example
// Example event object:
const e = {
  target: Table,       // The Table component that triggered the event.
  type: string,        // "insert", "remove", "move", "resize".
  index: number        // Only when type is "insert", "remove", or "resize". Index of the column.
  fromIndex: number,   // Only when type is "move". Indicates the previous index of the column.
  toIndex: number,     // Only when type is "move". Indicates the new index of the column.
  fromSize: number,    // Only when type is "resize". Indicates the previous size of the column.
  toSize: number,      // Only when type is "resize". Indicates the new size of the column.
  interactive: boolean // `true` when column was moved by the user interacting with the GUI. `false` when it was made programmatically.
};

onRowEvents(callbackopt, removeopt) → {Table|Array.<function()>}

Gets, registers or unregisters a row event handler function. This event handler is called when rows are inserted, removed, or cell value was updated (also check out onChange() event handler for to simply detect a cell value change).

Parameters:
NameTypeAttributesDefaultDescription
callbackfunction<optional>

The event handler function. Receives an event object.

removeboolean<optional>
false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: 
Table | Array.<function()>
Example
// Example event object:
const e = {
  target: object,        // The Table component that triggered the event.
  type: string,          // "insert", "remove", "update".
  row: number,           // Only when one row was effected. Index of the row.
  column: number         // Only when type is "update". Column index of effected cell. Value of -1 means that all columns were effected.
  fromRow: number        // Only when multiple rows were effected. Indicates beginning index within the range of effected rows.
  toRow: number          // Only when multiple rows were effected. Indicates the last index within the range of effected rows.
  interactive: boolean   // Only when type is "update". `true` when update was made by the user interacting with the GUI. `false` when update was made programmatically.
};

onSort(callbackopt, removeopt) → {Table|Array.<function()>}

Gets, registers or unregisters an event handler function for column sorting event. This event handler is called when a column is sorted by user or programmatically.

Parameters:
NameTypeAttributesDefaultDescription
callbackfunction<optional>

The event handler function. Receives an event object.

removeboolean<optional>
false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: 
Table | Array.<function()>
Example
// Example event object:
const e = {
  target: Table,         // The Table component that triggered the event.
  type: Table.SortOrder, // Table.SortOrder.None, Table.SortOrder.Ascending, or Table.SortOrder.Descending.
  column: number         // Only when type is not Table.SortOrder.None. Column index.
  newOrderColumn: number // Only when type is not Table.SortOrder.None. New column index, taking into account that columns may be re-ordered.
  interactive: boolean   // `true` when sorting was made by the user interacting with the GUI. `false` when it was made programmatically.
};

primaryColumn(columnopt) → {number}

Gets or sets the primary column of the table. The primary column is used to generate a list (e.g., files or URIs) when rows are dragged from the Table, and the table's data type includes FileList, URIList, or URL.

Parameters:
NameTypeAttributesDescription
columnnumber<optional>

The value to set for the primary column. If omitted, the current primary column value is returned.

Returns:
  • The current value of the primary column if no argument is provided (default is 0), or the instance of this Table for method chaining.
Type: 
number

removeColumn(i, new_orderopt) → {Table}

Removes a column at specified index. Also data at that column index for each row will also be removed.

Parameters:
NameTypeAttributesDefaultDescription
inumber

Index of the column to remove.

new_orderboolean<optional>
false

Should the index be interpreted as a new sorted order index or original order. Default is false.

Returns:

Returns this Table instance for method chaining.

Type: 
Table

removeRow(i, new_orderopt) → {Table}

Removes one row at a specified index.

Parameters:
NameTypeAttributesDefaultDescription
inumber

Index of the row to remove.

new_orderboolean<optional>
false

Indicates if given index is adjusted the sort order.

Returns:

Returns an instance of this Table for method chaining.

Type: 
Table

row(index, new_orderopt, rowopt) → {Array.<(string|number|boolean)>|Table}

Gets or updates an existing row at a specified index.

Parameters:
NameTypeAttributesDefaultDescription
indexnumber

Index of the row.

new_orderboolean<optional>
false

Specifies if "index" argument is based on new sorted order (true) or not (false).

rowArray.<(string|number|boolean)><optional>

array - A new row that will replace an existing row at specified index.

Returns:

When retrieving a row an Array is returned. When updating updating a row an instance of this Table is returned.

Type: 
Array.<(string|number|boolean)> | Table
Example
// To update values of an existing row at index 5
table.row(5, false, ["Jane Dow", 40, false, "Charlotte, NC", "[View|Remove]"]);

rowBackground(color) → {string|Table}

Sets or gets a background color of rows.

Parameters:
NameTypeDescription
colorstring

Hex style color string (e.g. #004453 or #00445377 with alpha), or null to reset background color to default.

Returns:

Returns current value when no argument is passed, otherwise returns this Table instance for method chaining.

Type: 
string | Table

rowSize(heightopt, indexopt) → {number|Table}

Gets/Sets/Resets the height of all table rows or one existing row at specified index.

Parameters:
NameTypeAttributesDefaultDescription
heightnumber | null | undefined<optional>

Set number to set height to specific number, null to reset height to default value, undefined to get height.

indexnumber<optional>
-1

Index of a specific row to apply given height to. Index is the original row position, it doesn't change due to sorting. -1 means that height will be applied to all rows.

Returns:
  • If no argument is passed or height is set to undefined then current value is returned, otherwise this Table instance is returned for method chaining.
Type: 
number | Table
Examples
// To get height of all rows
let h = table.rowSize();

// To get a height of a specific row at index 5
let h = table.rowSize(undefined, 5);
// To set height to all rows
table.rowSize(40);

// To set height to row at index 5
table.rowSize(40, 5);
// To reset height of all rows to default height
table.rowSize(null);

// To reset height of row at index 5 to default height
table.rowSize(null, 5);

rowStyle(index, new_orderopt, styleopt) → {Object|Table}

Sets or gets a row style at a specified row index. When the row is removed, the row style is also removed.

Parameters:
NameTypeAttributesDefaultDescription
indexnumber

The row index.

new_orderboolean<optional>
false

Should the index be interpreted as a new sorted order index or original order. Default is false.

styleObject | null<optional>

An object containing style properties to set, undefined to get the row style object, or null to clear the styles. For example: {background:"#FF0000", color:"#0000FF", size: 40}. Set to null to clear all styles, or set a specific property to null to remove only that style (e.g., {background:null}). If omitted, the function returns the current style properties of the row.

Returns:
  • When setting the style, an instance of this Table is returned, otherwise a current style of specified row is returned.
Type: 
Object | Table
Examples
// how to set style for a row index 5
table.rowStyle(5, false, {background:"#FF0000", color:"#FFAAAA", size: 40}});

// how to reset one style a row at index 5
table.rowStyle(5, false, {color:"#FFAAAA"}});

// how to remove all styles from a row at index 5
table.rowStyle(5, false, null});
// How to get style of a row at index 5
let style = table.rowStyle(5);
console.log(style);

rows(rows_or_new_orderopt, filteropt) → {Array|Table}

Sets or gets all rows (array of arrays representing rows and cells) of the table. When setting rows, it replaces existing rows. To simply remove all rows pass null or empty Array as first argument. When getting rows you can pass "true" to get them in the new sorted order instead of original order. To filter out some rows pass filter argument. See Table#filter function's documentation for details about filter expression.

Parameters:
NameTypeAttributesDefaultDescription
rows_or_new_orderArray | boolean<optional>
false

Array of rows to set for the table, or boolean true to return the rows in the new sorted order or false for original order.

filterstring<optional>

Filter expression to retrieving only rows that meet the specified criteria. Default is undefined, no filter. Only use it for getting rows, NOT setting. Learn more about filter expression in docs from Table#filter method.

Returns:

When settings rows to the table an instance of this this Table is returned. When retrieving rows a two-dimensional Array of rows is returned.

Type: 
Array | Table

selectAll(selectedopt) → {Table}

Selects/Deselects all rows in the Table

Parameters:
NameTypeAttributesDefaultDescription
selectedboolean<optional>
true

true to select all rows, false to deselect all rows.

Returns:

Returns an instance of this Table for method chaining.

Type: 
Table

selectedCell(rowopt, columnopt) → {Array.<number>|Table}

Sets or gets a row and a column of selected cell.

Parameters:
NameTypeAttributesDescription
rownumber<optional>

Row of a cell. (Original order is used, sorting is disregarded.)

columnnumber<optional>

Column of a cell (required if row is specified). (Original order is used, column reordering is disregarded.)

Returns:

When both row and cell are passed, an instance of this Table is returned, otherwise a currently selected row and column is returned as an array of integers [row, column], or NULL if there is no selection.

Type: 
Array.<number> | Table

selectedIndex(index) → {number|Table}

Sets or returns an index of a single selected row. If multiple rows are selected, it returns an index of the first one. Original row order is used (sorting is disregarded).

Parameters:
NameTypeDescription
indexnumber

Index of the row to select. If index is not valid, it will have no effect.

Returns:

When setting index, an instance of this Table is returned, otherwise a currently selected first row's index is returned, or -1 if no row is selected.

Type: 
number | Table

selectedValue(valueopt) → {string|number|boolean|Table}

Sets or gets a value in currently selected cell (row and column).

Parameters:
NameTypeAttributesDescription
valuestring | number | boolean<optional>

Value to set to the cell. Omit to get the value instead of setting.

Returns:

When setting a value an instance of this Table is returned, otherwise a current value is returned.

Type: 
string | number | boolean | Table

selection(selectionopt, new_orderopt, add_removeopt) → {Table|Array.<number>}

Sets/Removes selection of single row, list, or a range of rows, or gets an array of currently selected rows. Without arguments this returns an array of currently selected row indexes.

Parameters:
NameTypeAttributesDefaultDescription
selectionnumber | Array.<number> | Object | null<optional>

One index, an array of indexes, or a index range object {from:number, to:number}. Pass null to clear current selection. Omit this argument to get current selection.

new_orderboolean<optional>
false

Use new order after the rows were sorted (true) instead of using original order of rows by default (false). Default is false.

add_removeboolean<optional>

Instead of setting a new selection use true to add, or false to remove from existing selection. Default is undefined.

Returns:

When setting selection, an instance of this Table is returned. When getting selection, an array if indexes is returned.

Type: 
Table | Array.<number>
Examples
// Example of clearing current selection
table.selection(null);
// Examples of setting selection using a single index:
table.selection(5) - Selects a single row.
table.selection(5, true) - Selects a single row based on new sort order.
table.selection(5, false, true) - Selects an additional single row (if it wasn't selected yet) based on original order.
// Examples of selecting a range of rows using an index range object:
table.selection({from:5, to:9}) - Selects only a range of rows from index 5 to 9 (Only possible when selection mode is set to SelectionMode.Range or SelectionMode.Multiple).
table.selection({from:5, to:9}, true) - Selects only a range of rows from index 5 to 9 based on new sort order (Only possible when selection mode is set to SelectionMode.Range or SelectionMode.Multiple).
table.selection({from:5, to:9}, true, true) - Selects a range of rows from index 5 to 9 based on new sort order in addition to previously selected rows (Only possible when selection mode is set to SelectionMode.Range or SelectionMode.Multiple).
// Examples of selecting/deselecting multiple rows using an array of indexes:
table.selection([6, 7, 4, 1]) - Selects only indexes specified in the array (Multiple intervals (ranges) are only possible when selection mode is set to SelectionMode.Multiple).
table.selection([6, 7, 4, 1], true) - Selects only indexes specified in the array  based on new sort order (Multiple intervals (ranges) are only possible when selection mode is set to SelectionMode.Multiple).
table.selection([6, 7], true, false) - Deselects rows at indexes specified in the array based on new sort order from previously selected rows.

selectionMode(modeopt)

Sets or gets selection mode, how user is able to select rows; only one at a time, any multiple rows, or only a range of rows. Default is "Table.Single".

Parameters:
NameTypeAttributesDescription
modeSelectionMode<optional>

One of: SelectionMode.Single (default), SelectionMode.Range, SelectionMode.Multiple. See SelectionMode.

Returns:

(SelectionMode|Table} When setting mode, an instance of this Table is returned, otherwise current mode is returned.

sortOrder(columnopt, new_column_orderopt, orderopt) → {Table|object|null}

Gets or sets current sort state of the table rows by specifying column and order. Does not sort by columns that are set to be not sortable.

  • When called without arguments, returns the current sort configuration.
  • When called with arguments, updates the sort state for the specified column.
  • Columns marked as non-sortable will be ignored.

See usage examples below.

Parameters:
NameTypeAttributesDefaultDescription
columnnumber | null | undefined<optional>

Column index to sort by, or null to clear sorting al onn columns. Omit or leave undefined to get current sort state.

new_column_orderboolean<optional>
false

Whether the given column index should be interpreted as a new column order (useful if columns were reordered).

orderTable.SortOrder<optional>
Table.SortOrder.None

One of: Table.SortOrder.None (default), Table.SortOrder.Ascending, Table.SortOrder.Descending.

Returns:

Returns this Table object for method chaining when settings a sort, otherwise returns current sort order as {column:number, order:Table.SortOrder} or null when table rows are not sorted.

Type: 
Table | object | null
Examples
<h2>Setting a sort column and order:</h2>
// Sorts rows by column 2 in descending order
table.sortOrder(2, false, Table.SortOrder.Descending);

// Resets sorting by column 2 while still sorting by previously sorted columns (if any)
table.sortOrder(2, false, Table.SortOrder.None);

// Resets row sorting for all columns. Rows become unsorted.
table.sortOrder(null);
<h2>Getting current sort state:</h2>
let sorting = table.sortOrder();
// returns `null` if there was no sorting applied to the table
// or object like {column: 2, order: Table.SortOrder.Descending} if column 2 is currently sorted.
// Returned `column` index is the original column index (remain same even after after columns were reordered).

triStateSorting(enabledopt) → {boolean|Table}

Sets or gets whether sorting can be toggled to unsorted state.

Parameters:
NameTypeAttributesDescription
enabledboolean<optional>

true to enable, false to disable. Omit to get current value.

Returns:

When setting, and instance of this Table is returned, otherwise a current value is returned.

Type: 
boolean | Table

valueAt(row, column, new_orderopt, valueopt) → {string|number|boolean|Table}

Sets or gets a value at a specified row and column. Returns undefined if specified row or column doesn't exist.

Parameters:
NameTypeAttributesDefaultDescription
rownumber

Index of the row in question

columnnumber

Index of the column in question

new_orderboolean<optional>
false

To use the new sorted order of rows and columns or not

valuestring | number | boolean<optional>

The value to set the specified cell

Returns:

Returns the current cell value if new value is provided by value parameter; otherwise, returns the Table instance for chaining.

Type: 
string | number | boolean | Table