DS Server

Javascript: TableOfContentsCollection.remove Method

Method|Introduced in 29.0

Description

Removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.

Syntax

<void> TableOfContentsCollection.remove(<TableOfContents> element, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
element

The table of contents to remove.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates TableOfContentsCollection.remove in a practical document-editing workflow. It removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.

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

function remove(tableOfContentss, element) {
    tableOfContentss.remove(
        element,
        function() {
            console.log("remove completed.");
        },
        onTxError
    );
}