4 'Ext.tip.QuickTipManager'
7 Ext.onReady(function() {
10 Ext.define('Employee', {
11 extend: 'Ext.data.Model',
13 {name: 'email', type: 'string'},
14 {name: 'title', type: 'string'},
15 {name: 'firstName', type: 'string'},
16 {name: 'lastName', type: 'string'},
17 {name: 'phone-1', type: 'string'},
18 {name: 'phone-2', type: 'string'},
19 {name: 'phone-3', type: 'string'},
20 {name: 'hours', type: 'number'},
21 {name: 'minutes', type: 'number'},
22 {name: 'startDate', type: 'date'},
23 {name: 'endDate', type: 'date'}
27 var form = Ext.create('Ext.form.Panel', {
29 title : 'FieldContainers',
41 fieldLabel: 'Email Address',
47 xtype: 'fieldcontainer',
48 fieldLabel: 'Date Range',
81 defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
86 xtype: 'fieldcontainer',
94 {xtype: 'displayfield', value: '('},
95 {xtype: 'textfield', fieldLabel: 'Phone 1', name: 'phone-1', width: 29, allowBlank: false},
96 {xtype: 'displayfield', value: ')'},
97 {xtype: 'textfield', fieldLabel: 'Phone 2', name: 'phone-2', width: 29, allowBlank: false, margins: '0 5 0 0'},
98 {xtype: 'displayfield', value: '-'},
99 {xtype: 'textfield', fieldLabel: 'Phone 3', name: 'phone-3', width: 48, allowBlank: false}
103 xtype: 'fieldcontainer',
104 fieldLabel: 'Time worked',
105 combineErrors: false,
112 xtype: 'numberfield',
117 xtype: 'displayfield',
122 xtype: 'numberfield',
127 xtype: 'displayfield',
133 xtype : 'fieldcontainer',
136 fieldLabel: 'Full Name',
142 //the width of this field in the HBox layout is set directly
143 //the other 2 items are given flex: 1, so will share the rest of the space
149 triggerAction: 'all',
150 forceSelection: true,
154 displayField: 'name',
157 store: Ext.create('Ext.data.Store', {
158 fields : ['name', 'value'],
160 {name : 'Mr', value: 'mr'},
161 {name : 'Mrs', value: 'mrs'},
162 {name : 'Miss', value: 'miss'}
188 text : 'Load test data',
189 handler: function() {
190 this.up('form').getForm().loadRecord(Ext.ModelManager.create({
191 'email' : 'abe@sencha.com',
193 'firstName': 'Abraham',
194 'lastName' : 'Elias',
195 'startDate': '01/10/2003',
196 'endDate' : '12/11/2009',
207 handler: function() {
208 var form = this.up('form').getForm(),
210 if (form.isValid()) {
211 Ext.iterate(form.getValues(), function(key, value) {
212 s += Ext.util.Format.format("{0} = {1}<br />", key, value);
215 Ext.Msg.alert('Form Values', s);
222 handler: function() {
223 this.up('form').getForm().reset();