DS Server

Javascript: TableRowCollection.add Method

Method|Introduced in 28.0

Description

Adds a count of rows before or after the first or last selected row.

Syntax

<void> TableRowCollection.add(<TableAddPosition> tableAddPosition, <number> count, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
tableAddPosition

Specifies where the new rows will be added.

count

Specifies the count of rows to be added.

callback

Optional. Receives whether the new rows could added.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TableRowCollection.add in a practical document-editing workflow. It adds a count of rows before or after the first or last selected row.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function add(tableRows) {
    tableRows.add(
        TXTextControl.TableAddPosition.After,
        1,
        function(result) {
            if (result) {
                console.log("add is available.");
            } else {
                console.warn("add is not available in the current document state.");
            }
        },
        onTxError
    );
}