Javascript: SubTextPart.getChildren Method
Description
Returns an array of the children of this SubTextPart.
Syntax
<void> SubTextPart.getChildren(<RequestSubTextPartsCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the children. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates SubTextPart.getChildren in a practical document-editing workflow. It returns an array of the children of this SubTextPart.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const subTextParts = mainText.subTextParts;
subTextParts.getItem(function(subTextPart) {
if (!subTextPart) {
console.warn("No sub text part is available at the current input position.");
return;
}
subTextPart.getChildren(
function(subTextParts) {
if (!subTextParts) {
console.warn("No sub text part was returned.");
return;
}
console.log("get children result:", subTextParts);
},
onTxError
);
}, onTxError);
}, onTxError);