2010-10-21 70 views
0

我在ExtJS中有一個Accordion,我想動態地爲它添加新的面板。 面板出現時需要摺疊。 我現在擁有的代碼將創建面板,但每個面板中的HTML都不會顯示。如何在Ext中動態添加新的摺疊面板到手風琴?

var loadoutput = new Ext.Panel({ 
title: 'Log', 
renderTo: 'logout', 
layout: 'accordion', 
defaults: { 
    bodyStyle: 'padding:10px', 
    collapsed: true 
}, 
layoutConfig: { 
    fill: true, 
    animate: true 
} 
}); 

function logOutput(_title, _html) { 
temp = new Ext.Panel(); 
temp.title = _title; 
temp.html = _html; 
temp.collapsed = true; 
loadoutput.items.add(temp); 
loadoutput.doLayout(); 
} 

logOutput("Well, that was interesting", "Dude, what's up? <br/>Hey hey hey<br/>AAAAAH."); 
logOutput("Hello", "Dude, what's up? <br/>Hey hey hey<br/>AAAAAH."); 
logOutput("What?", "Dude, what's up? <br/>Hey hey hey<br/>AAAAAH."); 
logOutput("Cat", "Dude, what's up? <br/>Hey hey hey<br/>AAAAAH."); 

回答

0

我認爲問題是,你正在使用的「項目」添加方法(這是一個Ext.util.MixedCollection)代替Ext.Panel的添加方法。

試試這個:

loadoutput.add(temp); 
0

因此,此代碼的工作上面。 items.add或添加兩個工作。一個問題是boxMinHeight。需要手動設置我猜。

相關問題