AbstractWidget
is a base class that provides common functionality and helper methods for defining widgets, it can be extended by concrete widget classes that implement specific UI elements (e.g. charts, tables, diagrams).
Here is an example of how to inherit from the AbstractWidget
class.
class MyCustomWidget extends AbstractWidget {
constructor(config) {
super(config);
}
onInit(context) {
return super.onInit(context).then(function () {
// do initialization stuff
}).catch(error => {
// handle error
});
}
onDestroy(context) {
super.onDestroy();
// dispose allocated resources
}
}
You can find more details about how to define widgets into this article.
By extending the abstract widget class you can leverage these methods:
addPeriodPicker(container, options, callback, context) | Create a period picker embedded in the widget. |
hideMessage() | Hides the displayed message added by the |
loadMetricDefinitions(context, resolve, reject) | Enriches the template metrics, accessible in the |
setLoaderVisible(visible) | Shows or hides the overlay spinner during asynchronous data loading according to the |
showError(error) | Displays an |
showMessage(text, severity) | Displays a |
showNoDataAvailable() | Displays the |