Expand all

mw.widgets.RowWidget

Table row widget. A RowWidget is used in conjunction with table widgets and should not be instantiated by themselves. They group together text input widgets to form a unified row of editable data.

Extends

Constructor

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

Create an instance of mw.widgets.RowWidget.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
data Array optional

The data of the cells

keys Array optional

An array of keys for easy cell selection

validate RegExp | function | string optional

Validation pattern to apply on every cell

index number optional

The row index.

label string optional

The row label to display. If not provided, the row index will be used be default. If set to null, no label will be displayed.

showLabel boolean optional
true

Show row label. Defaults to true.

deletable boolean optional
true

Whether the table should provide deletion UI tools for this row or not. Defaults to true.

Mixes in:
Source:

Methods

clear() #

Clear the field values.

getIndex() → {number} #

Get the row index.

Source:

Returns:

The row index

Type
number
Get the row index.

getLabel() → {string} #

Get the label displayed on the row. If no custom label is set, the row index is used instead.

Source:

Returns:

The row label

Type
string
Get the label displayed on the row.

insertCell(data, index, key) #

Insert a cell at a specified index.

Parameters:

Name Type Description
data string

The cell data

index number

The index to insert the cell at

key string

A key for easy cell selection

Source:
Insert a cell at a specified index.

onClear() #

Handle clear requests.

onInsertCell(data, index) #

Handle model cell insertions.

Parameters:

Name Type Description
data string

The initial data

index number

The index in which to insert the new cell

Source:
Handle model cell insertions.

onLabelUpdate() #

Update model label changes.

Source:
Update model label changes.

onRemoveCell(index) #

Handle model cell removals.

Parameters:

Name Type Description
index number

The removed cell index

Source:
Handle model cell removals.

onValueChange(index, value) #

Handle model value changes.

Parameters:

Name Type Description
index number

The column index of the updated cell

value number

The new value

Source:

Fires:

Handle model value changes.

removeCell(index) #

Removes a column at a specified index.

Parameters:

Name Type Description
index number

The index to removeColumn

Source:
Removes a column at a specified index.

setIndex(index) #

Set the row index.

Parameters:

Name Type Description
index number

The new index

Source:
Set the row index.

setLabel(label) #

Set the label to be displayed on the widget.

Parameters:

Name Type Description
label string

The new label

Source:

Fires:

Set the label to be displayed on the widget.

setValue(index, value) #

Set the value of a particular cell.

Parameters:

Name Type Description
index number

The cell index

value string

The new value

Source:
Set the value of a particular cell.

Events

deleteButtonClick() #

Fired when the delete button for the row is pressed.

Source:
Fired when the delete button for the row is pressed.

inputChange(index, value) #

Change when an input contained within the row is updated.

Parameters:

Name Type Description
index number

The index of the cell that changed

value string

The new value of the cell

Source:
Change when an input contained within the row is updated.

labelUpdate(label) #

Parameters:

Name Type Description
label string
Source: