TX Text Control .NET Server

Javascript: DocumentTargetCollection.remove Method

Method|Introduced in 28.0

Description

Removes the target from the collection.

Syntax

<void> DocumentTargetCollection.remove(<DocumentTarget> documentTarget, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
documentTarget

Specifies the target 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 DocumentTargetCollection.remove in a practical document-editing workflow. It removes the target from the collection.

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

function remove(documentTarget) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const documentTargets = mainText.documentTargets;
        documentTargets.remove(
            documentTarget,
            function() {
                console.log("remove completed.");
            },
            onTxError
        );
    }, onTxError);
}