Reden voor problemen met het doen van sjabloneren op een inhoudspaneel is dat, welke sjabloon-inhoud dan ook die u in de domNode plaatst waarnaar wordt verwezen met het hechtingspunt 'containerNode' , u bij het opstarten zult verliezen.
If there is no 'href' nor 'content' attributes set, they will simply be set to an empty string, thus leaving the Dialog.containerNode.innerHTML == ""
U hoeft niet afgeleid te worden van _TemplatedMixin omdat het dialoogvenster zelf een sjabloon-widget is. Wijzig dit in plaats daarvan in _WidgetsInTemplateMixin om te compenseren voor de lay-outwidgets van BorderContainer en de inhoud van uw dijit.form. Ook moet uw opmaak binnen de aangepaste sjabloon vooraf worden ingevuld, dus u kunt met zoiets als hier hier naartoe gaan:
Wijzig de sjabloon van oud bijlagepunt voor container naar deze
<div data-dojo-attach-point="containerNode"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region:'center'">
Then add requirements to your markup widgets in the template plus the _WidgetsInTemplateMixin
:
define(["dijit/Dialog",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!./dialog_templates/View.html",
//rest are for rendering example
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/form/Button"
}. ... );
Result should ressemble this, keeping your template View.html change in mind:
define([
'dojo/_base/declare',
'dijit/Dialog',
"dijit/_WidgetsInTemplateMixin",
"dojo/text!./dialog_templates/View.html",
//rest are for rendering example
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/form/Button"],
function(
declare,
Dialog,
_Mixin,
_template){
return declare('TemplatedDialog', [Dialog, _Mixin /*careful, widgetsintemplate is tricky*/ ], {
templateString : _template
})
})
You can fiddle here
EDIT:
As there is troubles with dialogs containing borderlayouts (its not unheard of anyways) here's a workaround:
_checkIfSingleChild: function() {
delete this._singleChild;
domClass.toggle(this.containerNode, this.baseClass + "SingleChild", !!this._singleChild);
},
templateString: '....'
Im not certain of the consequences, im thinking the borderlayout of yours might start to misbehave if you try to programmatically change its contents and dimensions.. But it will render - at least it does here: updated fiddle