I want to create a widget that contains a layoutWidget (for example BorderContainer).
The way that I typically create widgets is to inherit from:
- _WidgetBase
- _TemplatedMixin
- _WidgetsInTemplatedMixin
IE:
define([
"dojo/_base/declare", "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dijit/_WidgetsInTemplateMixin"
],
function(
declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin
) {
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin] ,{
templateString: template,
...
Unfortunately according to the WidgetsInTemplateMixin:
The dijit._WidgetsInTemplateMixin mixin does not support adding layout widgets as children. In particular there are issues with startup() and resize() calls to the children.
I have verified that this does in fact have layout issues. What is the recommended method to create a reusable widget containing a layoutWidget?
Options:
Inherit from _LayoutWidget - Can anyone recommend an example of this to follow?
Inherit from _WidgetBase, _TemplatedMixin and _WidgetsInTemplatedMixin and workaround issues with resize and startup. This is what I am presently doing but I am worried about how fragile it may be. I have found that if I create a resize method on my widget and call resize on the layout then everything works as expected (so far). I expect that this may not always work and could introduce tricky bugs.
- Other?
To Summarize:
For the purpose of encapsulation and reusability, I want to create a widget. The widget needs to contain a Layout Widget (BorderContainer in this case). What is the standard pattern to do this?