I am not lazy but have tried many ways try to reload a div(id=refreshable) which contains a dojo TabContainer(id=dojoTabbedPane). Each time after reloading the page all content in each tab show up one a stack(the tabs are missing).
I did some research, ask questions, and use dijit.byId("dojoTabbedPane").destroyRecursive();
before jQuery load and then call dojo.parser.parse(dojo.byId("dojoTabbedPane"));
after re load but never works.
So, please, can anyone share a simple snippet can actually show me that a tabContainer can look all right its container is refreshed? I swear I try many theoretical way to and it should work but can anyone show me a very simple code to let me see it works?
I don't know how to paste big chunk of code here otherwise I will give a base sample so everyone is interested can help to revise, here I have prepared a tabContainer from Dojo website, please help me to work it out. Thanks !!
<script type="text/javascript"
src="dojo/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>
<script type="text/javascript" >
function refresh_data(url, id) {
j('#'+id).load(url+' #'+id+' > *', function (response) {
dojo.parser.parse(dojo.byId("dojoTabbedPane"));
});
}
</script>
<script type="text/javascript">
var login_url = '<spring:url value="/login" />';
j(function() {
setInterval('refresh_data("file:///D:/Dojo/dojo.tabbed.pane_very_good.html?hash="+Math.random(), "refreshable");', 9000);
});
// this disables errors in IE7
function noError(){return true;}
window.onerror = noError;
</script>
<style type="text/css">
@import "dojo/dijit/themes/tundra/tundra.css";
</style>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
</script>
</head>
<body class="tundra">
<!-- this div is only for documentation purpose, in real development environments, just take it out -->
<div style="width: 350px; height: 300px">
<div data-dojo-type="dijit.layout.TabContainer" style="width: 100%; height: 100%;">
<div data-dojo-type="dijit.layout.ContentPane" title="My first tab" selected="false">
Lorem ipsum and all around...
</div>
<div data-dojo-type="dijit.layout.ContentPane" title="My second tab" selected="true">
Lorem ipsum and all around - second...
</div>
<div data-dojo-type="dijit.layout.ContentPane" title="My last tab" closable="true">
Lorem ipsum and all around - last...
</div>
</div>
</div>
</body>
Its a question regarding jQuery, whether or not load has allready set innerHTML of the #replaceable at the time the complete callback runs.. But simply uncomment the timeout lines to 'unhook' and let load mechanism finish before calling parser. So try this: