ebs.generateHtmlWidgetAsync
(FintechOS Studio 21.1.4 and later)
Asynchronously inserts a widget in an HTML element. The result of the operation is returned in a promise object.
Syntax
Copy
function ebs.generateHtmlWidgetAsync(widgetName: string, element: any, options: IGenerateWidgetOptions): Promise<void>;
| Parameter | Type | Description |
|---|---|---|
widgetName
|
string | Name of the widget you wish to insert. For more information about HTML widgets, see the FintechOS Studio User Guide. |
element
|
any | HTML element where the widget will be inserted. |
options
|
IGenerateWidgetOptions | Options for how the widget will be rendered and for passing input to the widget's code. |
Response
Returns a void promise object, allowing you to associate handlers in case of success or failure.
Type Aliases
Options for how the widget will be rendered and for passing input to the widget's code.
Copy
{
hideTitle?: boolean;
skipJavascript?: boolean;
context?: any;
}
| Property | Type | Description |
|---|---|---|
hideTitle (optional) |
boolean | Set to true if you don't want to display the widget name in the destination HTML element. |
skipJavascript (optional) |
boolean | Set to true to ignore the widget's JavaScript code and only include its HTML code in the destination HTML element. |
context (optional) |
any | Object to be passed to the widget's JavaScript code. |
Examples
In this example:
- We prepare the widget's options so that the title is not displayed and the formData object is passed as input using an object called fd.
- We will insert the widget in the HTML with the insertHere ID.
- We insert the myWidget HTML widget and log the operation's success or failure in the browser console.
Copy
var options = {
hideTitle: true,
skipJavascript: false,
context: {
fd: formData
}
};
var element = document.getElementById("insertHere");
ebs.generateHtmlWidgetAsync("myWidget", element, options)
.then(function () {
console.log("widget generated");
})
.catch(function (err) {
console.log(err);
});