]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('AddressBook.view.contact.Edit', {\r |
2 | extend: 'Ext.Container',\r | |
3 | xtype: 'contact-edit',\r | |
4 | \r | |
5 | requires: [\r | |
6 | 'Ext.form.Panel',\r | |
7 | 'Ext.form.FieldSet',\r | |
8 | 'Ext.field.Text'\r | |
9 | ],\r | |
10 | \r | |
11 | config: {\r | |
12 | title: 'Edit',\r | |
13 | layout: 'fit',\r | |
14 | \r | |
15 | items: [\r | |
16 | {\r | |
17 | xtype: 'formpanel',\r | |
18 | items: [\r | |
19 | {\r | |
20 | xtype: 'fieldset',\r | |
21 | defaults: {\r | |
22 | labelWidth: '35%'\r | |
23 | },\r | |
24 | title: 'Information',\r | |
25 | items: [\r | |
26 | {\r | |
27 | xtype: 'textfield',\r | |
28 | label: 'First Name',\r | |
29 | name: 'firstName'\r | |
30 | },\r | |
31 | {\r | |
32 | xtype: 'textfield',\r | |
33 | label: 'Last Name',\r | |
34 | name: 'lastName'\r | |
35 | },\r | |
36 | {\r | |
37 | xtype: 'textfield',\r | |
38 | label: 'Title',\r | |
39 | name: 'title'\r | |
40 | }\r | |
41 | ]\r | |
42 | },\r | |
43 | {\r | |
44 | xtype: 'fieldset',\r | |
45 | defaults: {\r | |
46 | labelWidth: '35%'\r | |
47 | },\r | |
48 | title: 'Contact Information',\r | |
49 | items: [\r | |
50 | {\r | |
51 | xtype: 'textfield',\r | |
52 | label: 'Telephone',\r | |
53 | name: 'telephone'\r | |
54 | }\r | |
55 | ]\r | |
56 | },\r | |
57 | {\r | |
58 | xtype: 'fieldset',\r | |
59 | title: 'Address',\r | |
60 | defaults: {\r | |
61 | labelWidth: '35%'\r | |
62 | },\r | |
63 | items: [\r | |
64 | {\r | |
65 | xtype: 'textfield',\r | |
66 | label: 'City',\r | |
67 | name: 'city'\r | |
68 | },\r | |
69 | {\r | |
70 | xtype: 'textfield',\r | |
71 | label: 'State',\r | |
72 | name: 'state'\r | |
73 | },\r | |
74 | {\r | |
75 | xtype: 'textfield',\r | |
76 | label: 'Country',\r | |
77 | name: 'country'\r | |
78 | }\r | |
79 | ]\r | |
80 | }\r | |
81 | ]\r | |
82 | }\r | |
83 | ],\r | |
84 | \r | |
85 | listeners: {\r | |
86 | delegate: 'textfield',\r | |
87 | keyup: 'onKeyUp'\r | |
88 | },\r | |
89 | \r | |
90 | record: null\r | |
91 | },\r | |
92 | \r | |
93 | updateRecord: function(newRecord) {\r | |
94 | this.down('formpanel').setRecord(newRecord);\r | |
95 | },\r | |
96 | \r | |
97 | saveRecord: function() {\r | |
98 | var formPanel = this.down('formpanel'),\r | |
99 | record = formPanel.getRecord();\r | |
100 | \r | |
101 | formPanel.updateRecord(record);\r | |
102 | \r | |
103 | return record;\r | |
104 | },\r | |
105 | \r | |
106 | onKeyUp: function() {\r | |
107 | this.fireEvent('change', this);\r | |
108 | }\r | |
109 | });\r |