javascript - dijit.findWidgets return null array? -


on jstl page have following divs

<div dojotype="dijit.layout.tabcontainer" style="width: 100%; height: 100%;" dolayout="false" id="dojotabbedpane" >             <c:foreach items="${summariesmap}" var="summaryentry">                 <div dojotype="dijit.layout.contentpane" title="${summaryentry.key}"> 

i try find divs under (including dojotabbedpane) in order recersively destroy contentpane under it. can use jquery.load() reload contents , use

dojo.parser.parse(dijit.byid("dojotabbedpane")); 

to re-parse component make sure tabbedpane can rendered(otherwise doesn't , cause memory leak or error)

here question is: (1) on right track re-parse dojo tabbedcontainer? (2) why each time findwidgets function return array size 0?

thanks in advance.

i'll answer 2 first: because dijit.findwidgets expects dom node, not widget. if need find widgets inside widget, can use getdescendants instead:

var descwidgets = dijit.byid("dojotabbedpane").getdescendants(); 

onto question 1: first off: if want destroy tabs in tabcontainer, can use :

dijit.byid("dojotabbedpane").destroydescendants(); 

now, if understand correctly, subsequently grab string of html server (using jquery), , want add tabcontainer. new content contains several contentpane divs, , want these become new tabs in tabcontainer.

i may wrong here, don't think that's doable without gnarly hack. once you've parsed/instantiated tabcontainer, should add tabs using addchild, passing instantiated contentpanes.

this means if new html content server (via jquery load):

<div dojotype="dijit.layout.contentpane" title="new tab1">foo</div> <div dojotype="dijit.layout.contentpane" title="new tab2">bar</div> 

.. best bet remove old tabcontainer , make new one, parse whole thing. if you're able change content server, perhaps can wrap in <div dojotype="dijit.layout.tabcontainer....


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -