Skip to content

Instantly share code, notes, and snippets.

@mteece
Created January 26, 2012 17:56
Show Gist options
  • Save mteece/1684043 to your computer and use it in GitHub Desktop.
Save mteece/1684043 to your computer and use it in GitHub Desktop.
Ext JS 4.0.7 form layout using Ext.form.Panel with Ext.form.FieldSet, help button tool, and toolbar interface.
Ext.create('Ext.form.Panel', {
title: 'Simple Form with FieldSets',
labelWidth: 75, // label settings here cascade unless overridden
url: '/user/save',
frame: true,
bodyStyle: 'padding: 5px 5px 0',
width: 550,
renderTo: Ext.getBody(),
layout: 'column', // arrange fieldsets side by side
defaults: {
bodyPadding: 4
},
items: [{
// Fieldset in Column 1
xtype:'fieldset',
columnWidth: 0.5,
title: 'Fieldset 1',
collapsible: false,
defaultType: 'textfield',
defaults: {anchor: '100%'},
layout: 'anchor',
items :[{
fieldLabel: 'Field 1',
name: 'field1'
}, {
fieldLabel: 'Field 2',
name: 'field2'
}]
}, {
// Fieldset in Column 2
xtype:'fieldset',
title: 'Fieldset 2',
columnWidth: 0.5,
collapsed: false,
defaultType: 'textfield',
defaults: {anchor: '100%'},
layout:'anchor',
items :[{
fieldLabel: 'Field 3',
name: 'field3'
}, {
fieldLabel: 'Field 4',
name: 'field4'
}]
}],
tools:[{
type:'help',
tooltip: 'Get Help',
handler: function(event, toolEl, panel){
// show help here
}
}],
tbar: [{
xtype: 'tbtext',
text: 'Toolbar Text 1'
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment