Sun 24 Sep 2006
When I worked on dialog support for the new Editor2 (which is already committed to dojo svn), I wanted to use other dojo widgets in the template of the various dialogs: so instead of plain checkboxes/buttons, the more eyecandy widgets in dojo could be used.
Unfortunately, no widgets in widget template was supported by then. There indeed was a patch submitted for this very issue, but no official ways to achieve that.
After invesigating the code in the patch, I decided to write my own widget to support this. I took a slightly different approach. After asking Bill to review the first draft of the widget, we decided that merging the code into the DomWidget widget (the base widget for all HtmlWidgets) directly would be better. That was the origin of the enableSubWidgets patch.
Some days later, Morris pinged me and asked whether it would be possible to add more features to the subwidgets support. As I did not foresee the requirements Morris has for the more advanced usage, it tool several days for us to discuss/understand/implement new features. The final output is that we decided to rename enableSubWidgets to widgetsInTemplates, and a new patch.
A bit of doc about this patch is provided in the ticket, which I’d like to quote here as well:
- It allows you to define widgets within your template markup. The feature must be enabled for the widget by defining widgetsInTemplate:true in your widget javascript (similar to how isContainer:true works)
- It allows you to attach those subwidgets to your widget - just use dojoAttachPoint on the widget definition node and the code does the rest of the magic
- It allows you to attach events from the subwidgets to your widget - just use dojoAttachEvents
- It allows you to ‘wrap’ subwidgets that are containers, and have the subwidget act as the container within markup e.g. if you have a TabContainer widget in a template and set dojoAttachPoint="subContainerWidget" then any child widgets (in markup only) get attached to the subwidget rather than the defined widget
RSS feed for comments on this post. TrackBack this post