i'm trying to develop a custom widget into CMV Viewer. I'm using the guide line of CMV Viewer but i have some problem to render the html content set into templete folder. This is my code: Initialize widget:`


// templates & widget css






], function(declare, _WidgetBase, _TemplatedMixin, template) {

return declare([_WidgetBase, _TemplatedMixin], {
    templateString: template

and this is my html cotent for structure widget:

<div data-dojo-type="dijit/layout/TabContainer" data-dojo-props="region:'center'" tabStrip="true" data-dojo-attach-point="tabContainer" class="tabContainer">
    <div data-dojo-attach-point="tabByAttribute" data-dojo-type="dijit/layout/ContentPane" title="${i18n.Labels.tabTitleByAttribute}" class="searchTab" selected="true">
        <div >
            <select style="width:100%;" data-dojo-attach-point="selectLayerByAttribute" data-dojo-type="dijit/form/Select"></select>
            <!--<select style="width:100%;" data-dojo-attach-point="selectLayerByAttribute" data-dojo-type="dijit/form/Select" data-dojo-attach-event="onChange:onAttributeLayerChange">

              <!--<input type="text" style="width:100%;" data-dojo-type="dijit/form/TextBox"/>-->
              <select style="width:100%;" data-dojo-type="dijit/form/Select">
                <option value="Uno">Livello 1</option>
                <option value="Due" selected="selected">Livello 2</option>
                <option value="Tre">Livello 3</option>

Now i set in the viwer my widget:

storico: {
            include: true,
            id: 'storico',
            type: 'titlePane',
            canFloat: true,
            path: 'gis/dijit/Storico',
            title: 'Storico',
            open: false,
            position: 0

but now when i try to open the widget into viewer doesn't show the html content that i write.

1 Answer 1


The arguments passed into the function need to include all of the modules/template/etc loaded in the initial declares statement in the proper order they are declared. You have omitted most of them

Your function should be called like this:

], function(




    /* all additional modules need to be defined as well */

) {

Then to use your template that includes widgets, the return statement needs to look something like this at a minimum:

return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
    widgetsInTemplate: true,
    templateString: template,

Note the addition of _WidgetsInTemplateMixin MixIn and the widgetsInTemplate: true, property.

This is obviously not a complete example as your widget doesn't do anything currently.

This is a question about how to write dijits using the dojo toolkit and not specific to CMV. As such, any further questions related to this should be directed to stackoverflow: https://stackoverflow.com/questions/tagged/dojo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.