Login Register

Trouble with dynamic creation of AccordionPanes

I have some script that programatically creates AccordionPanes based on information it finds via a datastore. I inserted in some alerts such that I could debug the code. It works with the alert in place ... however when I remove the alert statement, only one of the AccordionPanes (the selected one) is visible. I have looked at the generated page source, and the other AccordionPanes are being generated .. they just are not visible.

Here is my script:

dojo.addOnLoad(function() {
// Get the datasource description for the accordion panes
var store = new dojo.data.ItemFileReadStore({url: "datastores/navigation.json"});
var buildNav = function(items, request){
for (var i = 0; i < items.length; i++){
var item = items[i];
var name = store.getValue(item, "name");
var newChild = new dijit.layout.AccordionPane({title:name},dojo.doc.createElement('div'));
//build up content
var links = "

    "
    var children = store.getValues(item, "children");
    for (var j=0; j";
    links += store.getValue(child, "name");
    links += "

    ";
    }
    links += "

"
alert(links);
newChild.setContent(links);
dijit.byId('nav').addChild(newChild);
newChild.startup();
}
}
var throwErrorMsg = new function(error, request){
//alert("error!"+error);
}
var request = store.fetch({onComplete: buildNav, onError: throwErrorMsg});

var photo_request = {count: 20, start:0};
var itemNameMap = {
imageThumbAttr: "thumb",
imageLargeAttr: "large",
};
dijit.byId('photo_show').setDataStore(imageItemStore, photo_request, itemNameMap);
});

Continuation of information about problem

Sorry, part of my message was truncated.

It is the "alert(links)" statement which when removed causes the rendering problem.

Any thoughts anyone?? Help greatly appreciated -

A