PDA

View Full Version : Viewport and Button



Stephan123
19 Aug 2009, 6:08 AM
Hello !

I have an viewport with 2 regions.
In the region 'north' is a toolbar.
In this toolbar is the first button '123'.

Now i will add an button.
I take 'addItem' .

Why can i not see the button 'ABC' :-?


new Ext.Viewport({
layout : "border",
items : [{
region : "center",
title : "Hauptbereich",
id: 'center',
height: 500
},{
region : "north",
title : "Navigation",
autoHeight : true,
items: [{
xtype: 'toolbar',
id: 'toolbar',
height: 50,
items: [{
xtype: 'button',
text: '123'
}]
}]
}]
});

var tool = Ext.getCmp('toolbar');
tool.addItem({
xtype: 'tbbutton',
text: 'ABC'
});

Greetings

Stephan

Animal
19 Aug 2009, 6:10 AM
What, AGAIN?

Just use the Toolbar as the north region.

Like you have already been told.

19 Aug 2009, 6:15 AM
tool.doLayout() after tool.add();

Stephan123
19 Aug 2009, 7:11 AM
Hi JGarcia !

Thanks for the quick info and a big thanks for our book.
Ther are no many people in Germany with knowledge about
ExtJS.

Greetings

Stephan

Animal
19 Aug 2009, 7:26 AM
Listen to me.

You need:



new Ext.Viewport({
layout : "border",
items : [{
region : "center",
title : "Hauptbereich",
id: 'center',
},{
region : "north",
height: 27,
xtype: 'toolbar',
id: 'toolbar',
items: [{
xtype: 'button',
text: '123'
}]
}]
});

var tool = Ext.getCmp('toolbar');
tool.addItem({
xtype: 'tbbutton',
text: 'ABC'
});
tool.doLayout();