Dojo 1.8: Getting dest.appendChild is not a function while rendering a custom template

Posted by Jim Pedid on Stack Overflow See other posts from Stack Overflow or by Jim Pedid
Published on 2012-10-24T01:30:50Z Indexed on 2012/10/24 5:04 UTC
Read the original article Hit count: 373

Filed under:
|
|
|

After adding in the WidgetsInTemplateMixin, I am receiving an error

dest.appendChild is not a function

In the documentation, it claims that there will be an error if this.containerNode is not able to contain any child objects. However, I have marked the containerNode attachment point for a div with dojo type "dijit/layout/ContentPane". Can anyone explain to me why this isn't working?

Here is the Template file

<div class="${baseClass}">
    <div class="${baseClass}Container"
         data-dojo-type="dijit/layout/BorderContainer"
         data-dojo-props="design: 'headline'">
        <div data-dojo-type="dijit/layout/ContentPane"
             data-dojo-props="region: 'top'">
            Top
        </div>
        <div data-dojo-type="dijit/layout/ContentPane"
             data-dojo-props="region: 'center'"
             data-dojo-attach-point="containerNode">
        </div>
        <div data-dojo-type="dijit/layout/ContentPane"
             data-dojo-props="region: 'leading', splitter: true">
            Sidebar
        </div>
    </div>
</div>

Here is the javascript definition

define([
    "dojo/_base/declare",
    "dijit/_WidgetBase",
    "dijit/_OnDijitClickMixin",
    "dijit/layout/BorderContainer",
    "dijit/layout/ContentPane",
    "dijit/layout/TabContainer",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dojo/text!./templates/MainContainer.html"
], function (declare,
             _WidgetBase,
             _OnDijitClickMixin,
             BorderContainer,
             ContentPane,
             TabContainer,
             _TemplatedMixin,
             _WidgetsInTemplateMixin,
             template)
{

    return declare([_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin], {

        templateString:template,
        baseClass:"main"
    });

});

The custom widget defined declaratively

<div data-dojo-type="main/ui/MainContainer" data-dojo-props="title: 'Main Application'">
  Hello Center!
</div>

© Stack Overflow or respective owner

Related posts about templates

Related posts about dojo