How To Change Dojo Tabcontainer Behaviour To Simply Open An External Link Instead Of Showing A Contentpane?
I am working with a TabContainer having several different ContentPane children. Each of them is equipped with a href param to fetch external AJAX content shown when a tab is being
Solution 1:
ContentPanes are not actually iframes, so setting window.location.href would change the url of your entire page (dojo app) not just the ContentPane. Have you tried something like this:
cp2.set('href', 'http://www.google.com/')
Solution 2:
A possible workaround to meet the above mentioned requirements is to override the onClick
event of the ContentPane
's controlButton
:
/*
* ...
*/var cp2 = new dijit.layout.ContentPane({
title: 'Test 2',
style: 'padding: 10px;'
});
/*
* ...
*/
tc_nav.addChild(cp2);
/*
* ...
*/
tc_nav.startup();
/*
* ...
*/
cp2.controlButton.onClick = function() {
window.location.href = 'http://www.google.com/';
};
Please note not to attach another function to the onClick
event (e. g. by dojo.connect(cp2.controlButton, 'onClick', function() { /* ... */ });
), but rather to override it, otherwise the ContentPane
's content would be called up first.
Please note further the TabContainer
's startup()
function has to be invoked first to make the controlButton
object accessible.
Post a Comment for "How To Change Dojo Tabcontainer Behaviour To Simply Open An External Link Instead Of Showing A Contentpane?"