AnsweredAssumed Answered

How to assign content from variable to contentPane programmatically

Question asked by amreecihuy on Mar 6, 2015
Latest reply on Mar 6, 2015 by kenbuja

Hi All,  I'm newbie in dojo. I have created TabContainer programmatically based on dojotoolkit tutorial.

here is the code

require(["dijit/layout/TabContainer", "dijit/layout/ContentPane","dojo/dom", "dojo/domReady!"],
    function(TabContainer, ContentPane,dom){
    var tc = new TabContainer({
        style: "height: 100%; width: 100%;"
    }, "layerPanel");

    var layerlistMenu = new ContentPane({
         title: "Layer",
         content: "this is layer list"
    });
    tc.addChild(layerlistMenu);

    var legendMenu = new ContentPane({
         title: "Legend",
         content: "this is legend"
    });
    tc.addChild(legendMenu);
   
    tc.startup();
});

 

here is the actual result, the content is harcoded.

result1.jpg

 

I have legend variable in another script like this :

var legend = new Legend ({
                        map: map
                    }, "legendDiv");
                    legend.startup();

 

I want to assign the legend content to legend tab.

here is my expectation :

result2.jpg

 

I did it using declarative method, could anyone please advice me how to assign legend content using programmatically method ?

thank you

 

-amri-

Outcomes