DS Server

Javascript: InputPosition.scrollTo Method

Method|Introduced in 28.0

Description

Scrolls the contents of a Text Control so that the current input position becomes visible.

Syntax

<void> InputPosition.scrollTo(<InputPosition.ScrollPosition> scrollPosition, <EmptyRequestCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
scrollPosition

Specifies an InputPosition.ScrollPosition value.

callback

Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates InputPosition.scrollTo in a practical document-editing workflow. It scrolls the contents of a Text Control so that the current input position becomes visible.

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

function scrollTo(scrollPosition) {
    TXTextControl.inputPosition.scrollTo(
        scrollPosition,
        function() {
            console.log("scroll to completed.");
        },
        onTxError
    );
}