3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
18 'Ext.tip.QuickTipManager'
21 Ext.onReady(function() {
24 Ext.define('Employee', {
25 extend: 'Ext.data.Model',
27 {name: 'email', type: 'string'},
28 {name: 'title', type: 'string'},
29 {name: 'firstName', type: 'string'},
30 {name: 'lastName', type: 'string'},
31 {name: 'phone-1', type: 'string'},
32 {name: 'phone-2', type: 'string'},
33 {name: 'phone-3', type: 'string'},
34 {name: 'hours', type: 'number'},
35 {name: 'minutes', type: 'number'},
36 {name: 'startDate', type: 'date'},
37 {name: 'endDate', type: 'date'}
41 var form = Ext.create('Ext.form.Panel', {
43 title : 'FieldContainers',
55 fieldLabel: 'Email Address',
61 xtype: 'fieldcontainer',
62 fieldLabel: 'Date Range',
95 defaultMargins: {top: 0, right: 5, bottom: 0, left: 0}
100 xtype: 'fieldcontainer',
108 {xtype: 'displayfield', value: '('},
109 {xtype: 'textfield', fieldLabel: 'Phone 1', name: 'phone-1', width: 29, allowBlank: false},
110 {xtype: 'displayfield', value: ')'},
111 {xtype: 'textfield', fieldLabel: 'Phone 2', name: 'phone-2', width: 29, allowBlank: false, margins: '0 5 0 0'},
112 {xtype: 'displayfield', value: '-'},
113 {xtype: 'textfield', fieldLabel: 'Phone 3', name: 'phone-3', width: 48, allowBlank: false}
117 xtype: 'fieldcontainer',
118 fieldLabel: 'Time worked',
119 combineErrors: false,
126 xtype: 'numberfield',
131 xtype: 'displayfield',
136 xtype: 'numberfield',
141 xtype: 'displayfield',
147 xtype : 'fieldcontainer',
150 fieldLabel: 'Full Name',
156 //the width of this field in the HBox layout is set directly
157 //the other 2 items are given flex: 1, so will share the rest of the space
163 triggerAction: 'all',
164 forceSelection: true,
168 displayField: 'name',
171 store: Ext.create('Ext.data.Store', {
172 fields : ['name', 'value'],
174 {name : 'Mr', value: 'mr'},
175 {name : 'Mrs', value: 'mrs'},
176 {name : 'Miss', value: 'miss'}
202 text : 'Load test data',
203 handler: function() {
204 this.up('form').getForm().loadRecord(Ext.create('Employee', {
205 'email' : 'abe@sencha.com',
207 'firstName': 'Abraham',
208 'lastName' : 'Elias',
209 'startDate': '01/10/2003',
210 'endDate' : '12/11/2009',
221 handler: function() {
222 var form = this.up('form').getForm(),
224 if (form.isValid()) {
225 Ext.iterate(form.getValues(), function(key, value) {
226 s += Ext.util.Format.format("{0} = {1}<br />", key, value);
229 Ext.Msg.alert('Form Values', s);
236 handler: function() {
237 this.up('form').getForm().reset();