PDA

View Full Version : How to add items to a Panel?



MadEric
13 Jun 2011, 7:23 PM
var panel= new Ext.Panel({
title: 'Report',
split: true,
width: 210,
height: 400,
minSize: 175,
maxSize: 400,
renderTo: Ext.get("divTreePanel"),
margins: '0 0 0 5',
layout: {
type: 'accordion',
animate: true,
hideCollapseTool: true
},
items:[]
});

I want to add items to this panel dynamically, for example:
var item = {
title: 'example',
border: false,
html: '<div id="divPanel"></div>',
listeners: {
'collapse': function () {

},
'expand': function () {

}
}
}
how to add this item to the items of the panel using a method? thanks

I have found the solution:
panel.add(item); panel.doLayout();