Friday, February 8, 2008

Nesting ExtJS 2.0 TreePanel inside Accordian

The Accordian panel in ExtJS 2.0 javascript framework, will error out if an item (Ext.Component) does not possess a header. The easiest way to create an header is to set the title property.

Here's the code

var tp = new Ext.tree.TreePanel(....);
tp.title = 'title ...'; // blows up without title

var accordian = new Ext.Panel({
layout: 'accordian',
region: 'west',
items: [
tp, // tree panel passed here
{
title:'another panel',
html: 'content here..'
}
]
.....
});

No comments: