PDA

View Full Version : [2.0a1][CLOSED] Toolbar in Window error



fancellu
10 Oct 2007, 6:59 AM
Take

http://extjs.com/deploy/ext-2.0-alpha1/examples/menu/menus.html

Comment out:


tb.render('toolbar');

And at the end have



window= new Ext.Window({
tbar:tb,
title: 'Resize Me',
width: 500,
height:300,
closeAction:'hide',
minWidth: 300,
minHeight: 200,
maximizable:true,collapsible :true,
plain:true,
bodyStyle:'padding:5px;'


});

window.show();

I get a complaint about this.tr being null, in both IE and FF.

jack.slocum
10 Oct 2007, 10:11 AM
The Window (and toolbar) must be rendered before calling add****() on the toolbar. This isn't apparent because a window is auto rendered on show if it hasn't been rendered yet. To add elements to the toolbar before render, you have to use the items configs on the toolbar.

fancellu
11 Oct 2007, 12:13 AM
Err, so what do I have to add where to make this example work?

jsakalos
14 Oct 2007, 2:46 PM
You need to add tbar:[array-of-items-of-top-toolbar] to the config.

leefaus
16 Oct 2007, 8:22 AM
I ran into the same issue. I wish the examples showed the integration of items better. Here is what I ended up with.



var combo = new Ext.form.ComboBox({
store: store,
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true
});




// Panel for the west
var nav = new Ext.Panel({
title: 'Navigation',
region: 'west',
split: true,
width: 300,
collapsible: true,
margins:'3 0 3 3',
cmargins:'3 3 3 3',
tbar: [combo]
});