The Old County
The Old County

Reputation: 89

Dojo, basic tab application

I am working on a dojo prototype. I've got several form widgets and tabs working. However how do I start to develop the application properly, to say create a button that toggles the tabs previous/next?

http://jsfiddle.net/aGCFs/239/

I've tried to include registry - but its not working as expected?

require(["dijit/registry"], function(registry){
   console.log("registry"); //registry.byId('second').set('disabled',!registry.byId('second').get('disabled'));
});

Upvotes: 0

Views: 73

Answers (1)

edchat
edchat

Reputation: 321

You can use tc.getIndexOfChild() and tc.selectedChildWidget along with tc.getChildren() to be able to avoid using id's. Like this:

nextTab = function () {
    var tc = registry.byId("mainTabContainer");
    console.log("next tab", tc);
    var currIndex = tc.getIndexOfChild(tc.selectedChildWidget);
    var tabs = tc.getChildren();
    if (currIndex < tabs.length - 1) {
        tc.selectChild(tabs[currIndex+1]);
    }

Here is a fiddle: http://jsfiddle.net/aGCFs/252/

Upvotes: 1

Related Questions