Expand all

mw.widgets.TableWidget

Groups row widgets together to form a bidimensional grid of text inputs.

Extends

Constructor

new mw.widgets.TableWidget([config]) #

Create an instance of mw.widgets.TableWidget.

Parameters:

Name Type Attributes Description
config mw.widgets.TableWidgetModel~Config optional

Configuration options

Mixes in:
Source:

Methods

clear() #

Clears all values from the table, without wiping any row or column properties.

Source:
Clears all values from the table, without wiping any row or column properties.

clearWithProperties() #

Clears the table data, as well as all row and column properties.

Source:
Clears the table data, as well as all row and column properties.

filterCellInput(value) → {string} #

Filter cell input once it is changed.

Parameters:

Name Type Description
value string

The input value

Source:

Returns:

The filtered input

Type
string
Filter cell input once it is changed.

insertColumn([data], [index], [key], [label]) #

Inserts a column into the table. If the column isn't added at the end of the table, all the following data will be shifted back one column.

Parameters:

Name Type Attributes Description
data Array optional

The data to insert to the column.

index number optional

The index in which to insert the new column. If unset or set to null, the column will be added at the end of the table.

key string optional

A key to quickly select this column. If unset or set to null, no key will be set.

label string optional

A label to display next to the column. If unset or set to null, the key will be used if there is one.

Source:
Inserts a column into the table.

insertRow([data], [index], [key], [label]) #

Inserts a row into the table. If the row isn't added at the end of the table, all the following data will be shifted back one row.

Parameters:

Name Type Attributes Description
data Array optional

The data to insert to the row.

index number optional

The index in which to insert the new row. If unset or set to null, the row will be added at the end of the table.

key string optional

A key to quickly select this row. If unset or set to null, no key will be set.

label string optional

A label to display next to the row. If unset or set to null, the key will be used if there is one.

Source:
Inserts a row into the table.

refreshTableMarginals() #

Refresh table header and insertion row.

Source:
Refresh table header and insertion row.

removeColumn(key) #

Removes a column from the table. If the column removed isn't at the end of the table, all the following columns will be shifted back one column.

Parameters:

Name Type Description
key number | string

The key or numerical index of the column to remove.

Source:
Removes a column from the table.

removeRow(key) #

Removes a row from the table. If the row removed isn't at the end of the table, all the following rows will be shifted back one row.

Parameters:

Name Type Description
key number | string

The key or numerical index of the row to remove.

Source:
Removes a row from the table.

setData(data) → {boolean} #

Set the table data.

Parameters:

Name Type Description
data Array

The new table data

Source:

Returns:

The data has been successfully changed

Type
boolean
Set the table data.

setValue(row, col, value) #

Set the value of a particular cell.

Parameters:

Name Type Description
row number | string

The row containing the cell to edit. Can be either the row index or string key if one has been set for the row.

col number | string

The column containing the cell to edit. Can be either the column index or string key if one has been set for the column.

value any

The new value

Source:
Set the value of a particular cell.

Events

change(rowIndex, rowKey, columnIndex, columnKey, value) #

Change when the data within the table has been updated.

Parameters:

Name Type Description
rowIndex number

The index of the row that changed

rowKey string

The key of the row that changed, or undefined if it doesn't exist

columnIndex number

The index of the column that changed

columnKey string

The key of the column that changed, or undefined if it doesn't exist

value string

The new value

Source:
Change when the data within the table has been updated.

removeRow(index, key) #

Fires when a row is removed from the table.

Parameters:

Name Type Description
index number

The index of the row being deleted

key string

The key of the row being deleted

Source:
Fires when a row is removed from the table.