lundi 9 novembre 2015

Show a widget upon button click on dojo 1.10

I am very new to dojo, javascript and web dev in general. My problem is when I link these files like this, the content doesn't appear when I try to debug it, no tab container gets populated. Any help is appreciated.

I have several files: index.jsp, Header.js and Pref.js.

index.jsp

//created div tags to store a tab container
<div id=someContainer> 
    <div data-dojo-type="widgets/Header" id="header_widget" containerId="myTabContainer"></div>
    <div data-dojo-type="widgets/Mark" id="mark_tab_cont"></div>
</div>

Header.js

//some button onclick function
onClick: function({
    Mark.showTabContainer;
});

Mark.js

define([..., "dijit/layout/TabContainer", "digit/layout/ContentPane"], 
function(..., TabContainer, ContentPane) {
    var getTabs = function({
        var tc = new TabContainer({
            style: "height: 100%; width: 100%;" 
        });
        var cp1 = new ContentPane({
            title: "Food",
            content: "We offer amazing food"
        });
        tc.addChild(cp1);

        var cp2 = new ContentPane({
            title: "Drinks",
            content: "We are known for our drinks."
        });
        tc.addChild(cp2);
        tc.placeAt("mark_tab_cont");
        tc.startup();
    },

    var Mark = declare("Mark", [_WidgetBase], {
        divID: "mark_tab_container", 
        postCreate: function() {
        },
        showTabContainer: function() {
            getTabs();
        }
    });
    return Mark;
});




Aucun commentaire:

Enregistrer un commentaire