I am a beginner of extjs.
I want to arrange some TextFields as below:
a:______ b:______ c:______
d:______ e:______ f:______
here are my test codes below:
Ext.onReady(function()
{
new Ext.panel.Panel(
{
renderTo: Ext.getBody(),
layout:'vbox',
width: 670,
tbar: [{text:"Add"}],
defaults:
{
layout:"column",
height:50
},
items:
[
{
defaults:
{
labelAlign:"right",
labelWidth:50
},
items:
[
{
xtype: 'textfield',
fieldLabel: 'a'
},
{
xtype: 'textfield',
fieldLabel: 'b'
},
{
xtype: 'textfield',
fieldLabel: 'c'
}
]
},
{
defaults:
{
labelAlign:"right",
labelWidth:50
},
items:
[
{
xtype: 'textfield',
fieldLabel: 'd'
},
{
xtype: 'textfield',
fieldLabel: 'e'
},
{
xtype: 'textfield',
fieldLabel: 'f'
}
]
}
]
});
});
as a result, the page can’t display any TextFields.
Thank you for any help in advance!
You can do something like :
It is essentially your same example except replacing the
vboxlayout with the defaultautolayout. The reason why you example didn’t work is thatvboxlayouts need a height and width set on it somehow.You could also do something like :
It is a
columnlayout without the nested items as the one before. One nice thing about acolumnlayout is that it will shift as many items as it can to the left and if an item can’t fit it will go in the next row.Since the width is a static 670 it can only fit 3 text fields per row. Column layouts do not need a height set.