Javascript: Table.getNestedLevel Method
Description
Gets the nested level for the specified table. Top level tables have a level of 1.
Syntax
<void> Table.getNestedLevel(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the nested level as parameter. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Table.getNestedLevel in a practical document-editing workflow. It gets the nested level for the specified table. Top level tables have a level of 1.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const tables = mainText.tables;
tables.getItem(function(table) {
if (!table) {
console.warn("No table is available at the current input position.");
return;
}
table.getNestedLevel(
function(result) {
console.log("get nested level result:", result);
},
onTxError
);
}, onTxError);
}, onTxError);