TableCell extends Element
API model used to edit cells in a table.
Methods
append(html)
- html <String> HTML String to append.
The HTML String passed as an argument is added as a child at the back of the Element.
var cell = editor.getAPIModelById('id'); cell.append('<span>TEXT</span>');
prepend(html)
- html <String> HTML String to append.
The HTML String passed as an argument is added as a child to the front of the Element.
var cell = editor.getAPIModelById('id'); cell.prepend('<span>TEXT</span>');
deleteCol()
Delete a column that contains cells.
var cell = editor.getAPIModelById('id'); cell.deleteCol();
deleteRow()
Delete the row containing the cell.
var cell = editor.getAPIModelById('id'); cell.deleteRow();
insertCol([before = false])
- before <Boolean> Whether to add a column in front of a cell
Add a column after the cell. If the before value is true, a column is added to the front of the cell.
var cell = editor.getAPIModelById('id'); cell.insertCol(); // add column after cell cell.insertCol(true); // add column before cell
insertRow([before = false])
- before <Boolean> Whether to add a row before the cell
Add a row after the cell. If the before value is true, a row is added before the cell.
var cell = editor.getAPIModelById('id'); cell.insertRow(); // add row after cell cell.insertRow(true); // add row before cell
setColWidth(value[, unit = 'px'])
- value <Number> : Width of column
- unit <String> : Unit of width ('px', '%'). default 'px'. You must use the same units as the table width units.
Sets the width of the column containing the cell.
var cell = editor.getAPIModelById('id'); cell.setColWidth(200); cell.setColWidth(20, '%');
setRowHeight(value)
- value <Number> Height of row. The unit of value is 'px'.
Sets the height of the row containing the cell.
var cell = editor.getAPIModelById('id'); cell.setRowHeight(50);
setHTML(html)
- html <String> HTML string to set inside Cell
Set the HTML string value passed as an argument to the cell's internal HTML.
var cell = editor.getAPIModelById('id'); cell.setHTML('<p><span>Add HTML. All previously entered information will be erased.</span></p>');
setText(text)
- text <String> Text string to set inside the cell
Set the text string value passed as an argument to the internal Text of the cell.
var cell = editor.getAPIModelById('id'); cell.setText('Sample text.');
splitCell(row, col)
- row <Number> number of columns to split
- col <Number> number of rows to split
Splits a cell into a specified number of columns and rows. There may be restrictions when splitting merged cells.
var cell = editor.getAPIModelById('id'); cell.splitCell(2,2);