Javascript: SectionCollection.getItem Method
Description
Gets the section at the current input position or or the section in the collection with the given number.
Syntax
<void> SectionCollection.getItem(<RequestSectionCallback> callback, [<number> number], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the section. |
| number | Optional. The section number. The first section has the number 1. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates SectionCollection.getItem in a practical document-editing workflow. It gets the section at the current input position or or the section in the collection with the given number.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.sections.getItem(
function(section) {
if (!section) {
console.warn("No section was returned.");
return;
}
console.log("get item result:", section);
},
1,
onTxError
);