getAPIModelById

Release 2.11.0+

Returns the APIModel for editing via the API, looked up by ID.

Parameters

NameTypeDescription
idstringElement id
[options]object{ skipUndoRedo: false, skipRendering: false }

options

NameTypeDefaultDescription
skipUndoRedobooleanfalseWhen true, edits via this model are not pushed to the undo/redo stack. The existing undo/redo stack is also cleared.
skipRenderingbooleanfalseWhen true, edits are only applied to the model and not rendered. After all edits, call editor.render() separately.

Returns

TypeDescription
ElementThe API model for editing

Example

var table = editor.getAPIModelById('ID');
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

// skipUndoRedo: true
var table = editor.getAPIModelById('ID', { skipUndoRedo: true });
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

// skipRendering: true
var table = editor.getAPIModelById('ID', { skipRendering: true });
table.insertCol(1);
table.insertRow(1);
table.setWidth(400);

editor.render();