Hello all Javascript and Widget Experts .
I am scratching my head for the last two days trying to figure out how to enable my widget so it can be included on the same page twice .
Here is what I have done
1.driver.js ( Loads all the required ) Loading the jquery , jquery-ui, wdcreate.js, set tabs.js via document.write calls .
2.wdcreate.js ( creates the tab lists and content ) Nothing complex , just a ui and li lists to create 3 tabs content assigned to wHTML and then conent loaded via
document.getElementById(tabid+"_mywidget_container").innerHTML = wHTML;
3.settabs.js ( Ideally supposed to enable tabs ) has just one line to load the tab container
$(document).ready(function() {$( "#"+tabid+"_mywidget_container" ).tabs();});
4.index.html - ( test page that includes the widgets ) This page just has two widgets included
<script type='text/javascript'>
var tabid='001';
document.write('<scr'+'ipt type="text/JavaScript" src="http://localhost:8080/demo/driver.js"></scr'+'ipt>');
</script>
<div id="001_mywidget_container"></div>
<script type='text/javascript'>
var tabid='002';
document.write('<scr'+'ipt type="text/JavaScript" src="http://localhost:8080/demo/driver.js"></scr'+'ipt>');
</script>
<div id="002_mywidget_container"></div>
Now the issue is the tabs are rendered if I include only one widget in my index.html file , if I include two or three for that matter , It fails ..
Any suggestions or what Is it I have to do ? I have tried searching and to isolate the issue put together this small project , originally was using plain javascript and reverted to jQuery ( I am not an expert Javascript programmer). Realize that this has to do something with the window.onLoad
Also note that in the settabs , instead of assigning the tabid dynamically , if I use two calls one for each tabwidget id , it loads two tab containers ..
one can have multiple widgets on a single page ex one tab container to show information for one topic , another tabcontainer for another topic etc.. so a user looking to have a page which can show information on 6 topics will include 6 widgets/tabcontainers on the same page ...
Appreciate all your help. Thanks again.
Also here are the pages
http://www.werindia.com/demo/index1.html - widget included one time
http://www.werindia.com/demo/index2.html - widget included two times. in reality this could be any non zero number
http://www.werindia.com/demo/driver.js
http://www.werindia.com/demo/wdcreate.js
http://www.werindia.com/demo/settabs.js
This is the page with static containers -- but in reality these would be dynamic
http://www.werindia.com/demo/index3.html