Extending a widget
Extending a widget allows you to create a new version of an existing widget while retaining its functionality and adding new features.
To extend an existing widget, use the
gbc create-widget command as follows:
gbc create-widget customization/customization-project-dir MyEditWidget --base EditWidgetThis
command creates a custom widget with the following functionality:- Inheritance:
MyEditWidgetinherits features fromEditWidget.- You can add new features or override inherited ones in the JavaScript file, MyEditWidget.js.
- HTML template:
- The template file MyEditWidget.tpl.html will be empty.
- Options include copying the original template from EditWidget.tpl.html or creating a new template.
- Coexistence: Both
EditWidgetandMyEditWidgetcan be used together in the application.
For an example extending the MainContainerWidget, go to Extend the MainContainerWidget.
For details about the gbc create-widget command, go to gbc tool
page.