You should be able to add widgets in your template yes. There are only a few things you have to remind:
- You can not use a widget as the root element of the template,
- You should inherit from the
dijit/_WidgetsInTemplateMixin
as well, - Like all declarative markup, you still have to include the module itself (
dijit/TitlePane
), by adding it either to yourrequire()
ordefine()
. For example:
declare("my/Widget", [ _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin ], {
title: "My title",
content: "My content",
templateString: "<div>" +
"<div data-dojo-type=\"dijit/TitlePane\" data-dojo-props=\"title: '${title}'\">${content}</div>" +
"</div>"
});
I also made an example JSFiddle.