Ext.create('Ext.panel.Panel', {
title: 'Accordion Layout',
width: 300,
height: 300,
listeners:{
render:function(comp){
comp.items.items[0].collapse();
comp.items.items[2].collapse();
comp.items.items[1].expand();
}},
defaults: {
// applied to each contained panel
bodyStyle: 'padding:15px'
},
layout: {
// layout-specific configs go here
type: 'accordion',
titleCollapse: false,
animate: true,
activeOnTop: true
},
items: [{
title: 'Panel 1',
html: 'Panel content!'
},{
title: 'Panel 2',
html: 'Panel content!'
},{
title: 'Panel 3',
html: 'Panel content!'
}],
renderTo: Ext.getBody()
});
它不会改变第二个项目的图标。第一次不可扩展它的行为不符合预期。