2010-10-21 68 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。需要手动设置我猜。

相关问题