Table extends Element

The API model used to edit tables.

Methods


deleteCol(startIndex[, endIndex])

Deletes the specified column from the table. The startIndex value starts from 0, and if endIndex is not specified, only the column corresponding to startIndex is deleted.

var table = editor.getAPIModelById('id');
table.deleteCol(1);	// Delete the second column
table.deleteCol(1,3); // Delete from second to fourth column

deleteRow(startIndex[, endIndex])

Deletes the specified row from the table. The startIndex value starts from 0, and if endIndex is not specified, only the row corresponding to startIndex is deleted.

var table = editor.getAPIModelById('id');
table.deleteRow(1);	// Delete the second row
table.deleteRow(1,3); // Delete from second to foruth row

deleteContents()

Deletes all contents of cells inside the table.

var table = editor.getAPIModelById('id');
table.deleteContents();

insertCol(index)

Adds a column at the specified location.

var table = editor.getAPIModelById('id');
table.insertCol(1);

insertRow(index)

Adds a row at the specified location.

var table = editor.getAPIModelById('id');
table.insertRow(1);

mergeCell(startRowIndex, startColIndex, endRowIndex, endColIndex)

Merges the specified cells.

var table = editor.getAPIModelById('id');
table.mergeCell(0, 0, 1, 2);

replace(html)

Replaces the element itself with the HTML String passed as an argument.

var table = editor.getAPIModelById('id');
table.replace('<span>Table replaced</span>');

remove()

Removes the Element itself.

var table = editor.getAPIModelById('id');
table.remove();

setColWidth(index, value[, unit = 'px'])

지정된 열의 너비를 설정합니다.

var table = editor.getAPIModelById('id');
table.setColWidth(1, 100, 'px');
table.setColWidth(1, 20, '%');

setRowHeight(index, value)

Sets the height of the specified row.

var table = editor.getAPIModelById('id');
table.setRowHeight(1, 100);

setHeight(value[, unit = 'px'])

Sets the height of the table.

var table = editor.getAPIModelById('id');
table.setHeight(200);
table.setHeight(200, 'px');

setWidth(value[, unit = 'px'])

Sets the width of the table.

var table = editor.getAPIModelById('id');
table.setWidth(400);
table.setWidth(100, '%');