DS Server

Javascript: TrackedChange.setActive Method

Method|Introduced in 28.0

Description

Sets a value specifying whether the TrackedChange is currently active or not.

Syntax

<void> TrackedChange.setActive(<boolean> active, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
active

Specifies whether the TrackedChange is currently active or not.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates TrackedChange.setActive in a practical document-editing workflow. It sets a value specifying whether the TrackedChange is currently active or not.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(function(trackedChange) {
        if (!trackedChange) {
            console.warn("No tracked change is available at the current input position.");
            return;
        }
    
        trackedChange.setActive(
            true,
            function() {
                console.log("set active completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);