PDA

View Full Version : Failed to dynamically add items to Ext.Toolbar



dekely
25 Nov 2010, 1:13 AM
Hi All,
I'm unable to add items to a Ext.Toolbar.
I keep getting 'Line: 21103 Error: 'this.tr' is null or not an object'
Here is my simple code:


btnSend = new Ext.Button ({
text: 'Click Me'
});
var bar = new Ext.Toolbar();
bar.setHeight(30);
bar.add(btnSend);


Any ideas?

fay
25 Nov 2010, 3:31 AM
Where are you rendering the toolbar to?

Example:



var bar = new Ext.Toolbar();
bar.render(document.body);
bar.add(btnSend);
bar.doLayout();

Animal
25 Nov 2010, 5:38 AM
What Ext version?

dekely
27 Nov 2010, 9:27 PM
Ext 2.2.1

I render it directly to the Panel


this.panContainer = new Ext.Panel({
layout: 'anchor',
autoWidth: this.autoWidth,
tbar:this.createTopToolbar(),
items:
[
this.grid,
this.taskDetailsGridPanel
]
});

Animal
27 Nov 2010, 10:51 PM
Toolbar was not a Container in Ext 2.

It is long past time to upgrade.

dekely
27 Nov 2010, 11:00 PM
It works now, I guess it was something in my createToolbar() method.