Select to view content in your preferred language

How to assign content from variable to contentPane programmatically

2781
1
03-06-2015 02:13 AM
khairulamri
Deactivated User

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-

Tags (1)
0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor

Just as you use the "addChild" to add the ContentPane to the TabContainer, you add information to the ContentPane with "addChild"

legendMenu.addChild(legend);