Hi guys,
I'm using Dojo 1.2 and I'm running into the following problem...
I've created a templated custom widget which contains an AccordionContainer. I'm trying to add this custom widget (programmatically) as a child of an existing TabContainer. However when i do this, the AccordionContainer doesn't work properly i.e. you cannot see the contents in the AccordionPane's
Here is some simple code as an example. Any thoughts or alternate solutions?
All in all i need to programatically add the widget containing the AccordionContainer to the TabContainer.
thanks in advance
Here is my custom widget
dojo.provide("re.widget.TestWidget");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.form.Button");
dojo.declare(
"re.widget.TestWidget",
[dijit._Widget, dijit._Templated],
{
widgetsInTemplate: true,
templatePath: dojo.moduleUrl("re", "widget/templates/TestWidget.html"),
postMixInProperties:function(){
this.inherited("postMixInProperties", arguments);
},
postCreate: function(){
},
});Below is the TestWidget template
<div dojoType="dijit.layout.BorderContainer" gutters="false">
<div class="re" dojoAttachPoint="_menuBar" dojoType="dijit.layout.ContentPane" region="top">
<div dojoType="dijit.form.Button" label="hello"></div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center">
<div dojoType="dijit.layout.AccordionContainer" >
<div dojoType="dijit.layout.AccordionPane" title="pane 1" dojoAttachPoint="pane1" >
some data pane 1
</div>
<div dojoType="dijit.layout.AccordionPane" title="pane 2" dojoAttachPoint="pane2">
some data pane 2
</div>
<div dojoType="dijit.layout.AccordionPane" title="pane 3" dojoAttachPoint="pane3">
some data pane 3
</div>
</div>
</div>
</div>
<div class="re" dojoAttachPoint="_menuBar" dojoType="dijit.layout.ContentPane" region="top">
<div dojoType="dijit.form.Button" label="hello"></div>
</div>
<div dojoType="dijit.layout.ContentPane" region="center">
<div dojoType="dijit.layout.AccordionContainer" >
<div dojoType="dijit.layout.AccordionPane" title="pane 1" dojoAttachPoint="pane1" >
some data pane 1
</div>
<div dojoType="dijit.layout.AccordionPane" title="pane 2" dojoAttachPoint="pane2">
some data pane 2
</div>
<div dojoType="dijit.layout.AccordionPane" title="pane 3" dojoAttachPoint="pane3">
some data pane 3
</div>
</div>
</div>
</div>
And the test html page
<head>
<style type="text/css">
@import "../dojo/dojo/resources/dojo.css";
@import "../dojo/dijit/themes/tundra/tundra.css";
</style>
<script language="JavaScript" type="text/javascript">
djConfig = {
isDebug: true,
debugAtAllCosts: true,
modulePaths: {
"re": "../../js/re"
},
parseOnLoad: true,
usePlainJson: true
};
</script>
<script type="text/javascript" src="../dojo/dojo/dojo.js"></script>
<script>
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("re.widget.TestWidget");
dojo.require("dojo.parser");
dojo.addOnLoad(function() {
var tabcontainer = dijit.byId('tc');
var bvpId='testWidget';
var bvp = dijit.byId(bvpId);
if (!bvp) {
bvp = new re.widget.TestWidget({ id:bvpId,closable:true,title:'bustedtab'},document.createElement('div'));
tabcontainer.addChild(bvp);
}
tc.selectChild(bvp);
// setTimeout("dijit.byId('tc').selectChild(dijit.byId('"+bvpId+"'))",10);
});
</script>
</head>
<body class="tundra">
<div id="tc" dojoType="dijit.layout.TabContainer" style="height:50em">
<div dojoType="dijit.layout.ContentPane" title="tab 1">
test data
</div>
</div>
</body>
<style type="text/css">
@import "../dojo/dojo/resources/dojo.css";
@import "../dojo/dijit/themes/tundra/tundra.css";
</style>
<script language="JavaScript" type="text/javascript">
djConfig = {
isDebug: true,
debugAtAllCosts: true,
modulePaths: {
"re": "../../js/re"
},
parseOnLoad: true,
usePlainJson: true
};
</script>
<script type="text/javascript" src="../dojo/dojo/dojo.js"></script>
<script>
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("re.widget.TestWidget");
dojo.require("dojo.parser");
dojo.addOnLoad(function() {
var tabcontainer = dijit.byId('tc');
var bvpId='testWidget';
var bvp = dijit.byId(bvpId);
if (!bvp) {
bvp = new re.widget.TestWidget({ id:bvpId,closable:true,title:'bustedtab'},document.createElement('div'));
tabcontainer.addChild(bvp);
}
tc.selectChild(bvp);
// setTimeout("dijit.byId('tc').selectChild(dijit.byId('"+bvpId+"'))",10);
});
</script>
</head>
<body class="tundra">
<div id="tc" dojoType="dijit.layout.TabContainer" style="height:50em">
<div dojoType="dijit.layout.ContentPane" title="tab 1">
test data
</div>
</div>
</body>
