I have the following code in my page that creates a new Dojo/Dijit TabContainer.
<div dojoType="dijit.form.ComboButton" iconClass="dijitIconEdit">
<span>
Blank
</span>
<div dojoType="dijit.Menu">
<div dojoType="dijit.MenuItem" iconClass="dijitIconEdit">
Letter to Client
<script type="dojo/method" event="onClick">
newLetterToClientPane = dojox.layout.ContentPane({ title:'New Letter to Client', href:'some_url', closable:true })
dijit.byId('mainTabs').addChild(newLetterToClientPane)
</script>
</div>
<div dojoType="dijit.MenuItem" iconClass="dijitIconEdit">
Letter to Company
<script type="dojo/method" event="onClick">
newLetterToCompanyPane = dojox.layout.ContentPane({ title:'New Letter to Company', href:'some_url', closable:true })
dijit.byId('mainTabs').addChild(newLetterToCompanyPane)
</script>
</div>
</div>
</div>
This all works fine. I just wonder how I would give the new TabContainer an ID since I need to re-populate later in the script but I can’t do this with out and ID. I’m only asking because the Dojo page on dojox.layout.ContentPane and dijit.layout.ContentPane makes no mention of it.
The following should work:
You can then later access that widget by
for example
Note that jsid will create a global JS variable with the id you specify – so be careful if you do not want to add to the global memory
It does offer convenience though in that you dont need to do dijit.byId to access it
you could do:
if you use jsId as cp1
Aso note the difference between dojo.byId and dijit.byId:
http://dojotoolkit.org/reference-guide/1.7/dijit/info.html
Since id behavior is same across all widgets, I am guessing they added the details in the base dijit doc available at the link above