DS Server

Javascript: TableBaseCollection.getItem Method

Method|Introduced in 28.0

Description

Gets the first table in the collection with the given id.

Syntax

<void> TableBaseCollection.getItem(<RequestTableCallback> callback, [<ErrorCallback> errorCallback], <number> id)

Parameters

ParameterDescription
callback

Receives the requested table or null if there is no table at the current input position / with the requested id.

errorCallback

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

id

The table's identifier.

Examples

The following example demonstrates TableBaseCollection.getItem in a practical document-editing workflow. It gets the first table in the collection with the given id.

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

function inspectItem(tableBases) {
    tableBases.getItem(
        function(table) {
            if (!table) {
                console.warn("No table was returned.");
                return;
            }
            
            console.log("get item result:", table);
        },
        onTxError,
        25
    );
}