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.
clearWithProperties()
#
Clears the table data, as well as all row and column properties.
filterCellInput(value) → {string}
#
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. |
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. |
refreshTableMarginals()
#
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:
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:
setData(data) → {boolean}
#
setDisabled()
#
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 |
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 |
columnIndex |
number | The index of the column that changed |
columnKey |
string | The key of the column that changed, or |
value |
string | The new value |