PDA

View Full Version : How can I place a label above a button ?



Enrico.Massone
4 Jul 2012, 2:30 AM
Hello everyone,
I'm looking for help to complete a theoretically simple task with ExtJS 4.1.
Consider the following code, where I define a container which contains a textfield and a button:



xtype: 'container',
flex: 1,
layout: 'anchor',
items: [{
xtype: 'button',
text: 'Create new processing',
id: 'add_processing',
},{
xtype:'textfield',
fieldLabel: 'Email',
afterLabelTextTpl: required,
name: 'email',
vtype:'email'
}]


Given that code, is it possible to place a label ABOVE the button ?
Thanks in advance for your help.

Regards.

Enrico.

scottmartin
4 Jul 2012, 8:04 AM
You can create a container and use vbox layout to stack the label/button

Scott.

sword-it
4 Jul 2012, 11:05 PM
Hi,

You can use following code




Ext.onReady(function () {
win = new Ext.Window({
title: 'My First Window'
, width: 600
, height: 300
, layout: 'anchor'
, flex:1
, items: [
{
xtype:'box'
, html:'xyz'
},
{
xtype: 'button',
text: 'Create new processing',
id: 'add_processing',
},
{
xtype:'textfield',
fieldLabel: 'Email',
//afterLabelTextTpl: required,
name: 'email',
vtype:'email'
}
]


})
win.show();
})



output:
36840