2014-06-30 7 views

답변

3

dataArrray는 contentpane에 대한 데이터가 들어있는 객체의 배열이라고 가정합니다.

require(["dijit/layout/AccordionContainer", "dijit/layout/ContentPane", "dojo/domReady!"], 
     function(AccordionContainer, ContentPane){ 
    var aContainer = new AccordionContainer({style:"height: 300px"}, "markup"); 
    len = dataArray.length; 
    for (var i =0; i<len; i++); 
    { 
    aContainer.addChild(new ContentPane({ 
     title:dataArray[i].title, 
     content: dataArray[i].content 
    })); 
    } 
    aContainer.startup(); 
}); 
1

콘텐츠를 콘텐츠 패널에 추가해야합니다.

require(["dijit/layout/AccordionContainer", "dijit/layout/ContentPane", "dojo/domReady!"], 
     function(AccordionContainer, ContentPane){  
      var acc = new AccordionContainer(); 
      for(var i = 0; i < arr.length; i++) { 
       acc.addChild(new ContentPane()); 
      } 
     });