TableCell extends Element

API model used to edit cells in a table.

Methods

append(html)

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)

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])

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])

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'])

Sets the width of the column containing the cell.

var cell = editor.getAPIModelById('id');
cell.setColWidth(200);
cell.setColWidth(20, '%');

setRowHeight(value)

Sets the height of the row containing the cell.

var cell = editor.getAPIModelById('id');
cell.setRowHeight(50);

setHTML(html)

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)

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)

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);