Expand all

ve.ui.TableAction

Extends

Constructor

new ve.ui.TableAction(surface, [source]) #

Table action.

Parameters:

Name Type Attributes Description
surface ve.ui.Surface

Surface to act on

source string optional
Source:
Table action.

Methods

changeCellStyle(style) → {boolean} #

Change cell style

Parameters:

Name Type Description
style string

Cell style; 'header' or 'data'

Source:

Returns:

Action was executed

Type
boolean
Change cell style

create([options]) → {boolean} #

Creates a new table.

Parameters:

Name Type Attributes Description
options Object optional

Table creation options

Properties:
Name Type Attributes Default Description
caption boolean optional

Include a caption

header boolean optional

Include a header row

cols number optional
4

Number of columns

rows number optional
3

Number of rows (not including optional header row)

type Object optional
'table'

Table node type, must inherit from table

attributes Object optional

Attributes to give the table

Source:

Returns:

Action was executed

Type
boolean
Creates a new table.

decrementSpan(cell, mode, minIndex, maxIndex) → {function} #

Decreases the span of a cell so that the given interval is removed.

Parameters:

Name Type Description
cell ve.dm.TableMatrixCell

Table matrix cell

mode string

Span to decrement 'row' or 'col'

minIndex number

Smallest row or column index (inclusive)

maxIndex number

Largest row or column index (inclusive)

Source:

Returns:

Zero-argument function returning a ve.dm.Transaction

Type
function
Decreases the span of a cell so that the given interval is removed.

delete(mode) → {boolean} #

Deletes selected rows, columns, or the whole table.

Parameters:

Name Type Description
mode string

Deletion mode; 'row' to delete rows, 'col' for columns, 'table' to remove the whole table

Source:

Returns:

Action was executed

Type
boolean
Deletes selected rows, columns, or the whole table.

deleteRowsOrColumns(matrix, mode, minIndex, maxIndex) → {Array.<Object>} #

Deletes rows or columns within a given range.

e.g. rows 2-4 can be deleted using

ve.ui.TableAction.deleteRowsOrColumns( matrix, 'row', 1, 3 );

Parameters:

Name Type Description
matrix ve.dm.TableMatrix

Table matrix

mode string

'row' or 'col'

minIndex number

Smallest row or column index to be deleted

maxIndex number

Largest row or column index to be deleted (inclusive)

Source:

Returns:

Plain sub-matrix of items removed. In column mode this matrix is transposed.

Type
Array.<Object>
Deletes rows or columns within a given range.

deleteTable(tableNode) #

Deletes a whole table.

Parameters:

Name Type Description
tableNode ve.dm.TableNode

Table node

Source:
Deletes a whole table.

enterTableCell() → {boolean} #

Enter a table cell for editing

Source:

Returns:

Action was executed

Type
boolean
Enter a table cell for editing

exitTableCell() → {boolean} #

Exit a table cell for table-structure-editing

Source:

Returns:

Action was executed

Type
boolean
Exit a table cell for table-structure-editing

findClosestTableNode() → {ve.dm.TableNode|null} #

Find the closest table node to the current selection

This method is model-only.

Source:

Returns:

The closest table node, null if not found

Type
ve.dm.TableNode | null

Find the closest table node to the current selection

This method is model-only.

findClosestTableViewNode() → {ve.ce.TableNode|null} #

Find the closest table view node to the current selection

Source:

Returns:

The closest table view, null if not found

Type
ve.ce.TableNode | null
Find the closest table view node to the current selection

getTableSelectionFromSelection() → {ve.dm.TableSelection|null} #

Get a TableSelection that contains the current selection

This method is model-only.

Source:

Returns:

The closest TableSelection, null if not found

Type
ve.dm.TableSelection | null

Get a TableSelection that contains the current selection

This method is model-only.

importTable(importedTableNode, importInternalList) → {boolean} #

Import a table at the current selection, overwriting data cell by cell

Parameters:

Name Type Description
importedTableNode ve.dm.TableNode

Table node to import

importInternalList boolean

Import the table document's internalLiist

Source:

Returns:

Action was executed

Type
boolean
Import a table at the current selection, overwriting data cell by cell

incrementSpan(cell, mode) → {function} #

Increase the span of a cell by one.

Parameters:

Name Type Description
cell ve.dm.TableMatrixCell

Table matrix cell

mode string

Span to increment; 'row' or 'col'

Source:

Returns:

Zero-argument function returning a ve.dm.Transaction

Type
function
Increase the span of a cell by one.

insert(mode, position) → {boolean} #

Inserts a new row or column into the currently focused table.

Parameters:

Name Type Description
mode string

Insertion mode; 'row' to insert a new row, 'col' for a new column

position string

Insertion position; 'before' to insert before the current selection, 'after' to insert after it

Source:

Returns:

Action was executed

Type
boolean
Inserts a new row or column into the currently focused table.

insertRowOrCol(tableNode, mode, index, position, [selection], [dataMatrixLine]) #

Inserts a new row or column.

Example: a new row can be inserted after the 2nd row using

insertRowOrCol( table, 'row', 1, 'after' );

Parameters:

Name Type Attributes Description
tableNode ve.dm.TableNode

Table node

mode string

Insertion mode; 'row' or 'col'

index number

Row or column index of the base row or column.

position string

Insertion position; 'before' or 'after'

selection ve.dm.TableSelection optional

Selection to move to after insertion

dataMatrixLine Object optional

Data to insert

Properties:
Name Type Attributes Description
rowData Array optional

Row data if inserting a row

cells Array.<ve.dm.TableMatrixCell> optional

Table cells to insert

Source:
Inserts a new row or column.

mergeCells() → {boolean} #

Merge multiple cells into one, or split a merged cell.

Source:

Returns:

Action was executed

Type
boolean
Merge multiple cells into one, or split a merged cell.

move(mode, index) → {boolean} #

Move a column or row.

Parameters:

Name Type Description
mode string

Move mode; 'col' or 'row'

index number

Row or column index to move to

Source:

Returns:

Action was executed

Type
boolean
Move a column or row.

moveRelative(mode, direction) → {boolean} #

Move a column or row relative to its current position

Parameters:

Name Type Description
mode string

Move mode; 'col' or 'row'

direction string

Direction; 'before' or 'after'

Source:

Returns:

Action was executed

Type
boolean
Move a column or row relative to its current position

replacePlaceholder(matrix, placeholder, [options]) → {function} #

Inserts a new cell for an orphaned placeholder.

Parameters:

Name Type Attributes Description
matrix ve.dm.TableMatrix

Table matrix

placeholder ve.dm.TableMatrixCell

Placeholder cell to replace

options Object optional

Options to pass to ve.dm.TableCellNode.static.createData

Source:

Returns:

Zero-argument function returning a ve.dm.Transaction

Type
function
Inserts a new cell for an orphaned placeholder.

unmergeCell(matrix, ownerCell) #

Unmerge a cell

Parameters:

Name Type Description
matrix ve.dm.TableMatrix

Table matrix the cell is in

ownerCell ve.dm.TableMatrixCell

The cell to unmerge

Source:
Unmerge a cell