]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/kitchensink/classic/samples/view/direct/Form.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / kitchensink / classic / samples / view / direct / Form.js
CommitLineData
6527f429
DM
1/**\r
2 * This example shows a Form panel with Ext Direct integration.\r
3 */\r
4Ext.define('KitchenSink.view.direct.Form', {\r
5 extend: 'Ext.panel.Panel',\r
6 xtype: 'direct-form',\r
7 controller: 'directform',\r
8 \r
9 requires: [\r
10 'Ext.layout.container.Anchor',\r
11 'Ext.layout.container.Accordion',\r
12 'KitchenSink.view.direct.FormController'\r
13 ],\r
14 \r
15 //<example>\r
16 exampleTitle: 'Ext Direct Form integration',\r
17 exampleDescription: [\r
18 '<p>The following example illustrates how to load a FormPanel or BasicForm through Ext Direct.</p>',\r
19 '<p>Notice that Direct requests will batch together if they occur within the enableBuffer delay period (in milliseconds).</p>',\r
20 "<p>The Ext Direct Form api also supports submit in addition to load. The server-side must mark the submit handler as a 'formHandler' and will not be batched.</p>"\r
21 ].join(''),\r
22 \r
23 otherContent: [{\r
24 type: 'ViewController',\r
25 path: 'classic/samples/view/direct/FormController.js'\r
26 }, {\r
27 type: 'Base ViewController',\r
28 path: 'classic/samples/view/direct/DirectVC.js'\r
29 }, {\r
30 type: 'Server Profile class',\r
31 path: 'data/direct/source.php?file=profile'\r
32 }, {\r
33 type: 'Server API configuration',\r
34 path: 'data/direct/source.php?file=config'\r
35 }],\r
36 //</example>\r
37 \r
38 title: 'My Profile',\r
39 width: 500,\r
40 height: 400,\r
41 \r
42 layout: 'accordion',\r
43 \r
44 defaults: {\r
45 xtype: 'form',\r
46 border: false,\r
47 bodyPadding: 10,\r
48 \r
49 // These defaults will be applied to the children of this Panel,\r
50 // i.e. form panels. This is a neat way to reduce clutter\r
51 // and keep the code clean and declarative.\r
52 defaultType: 'textfield',\r
53 defaults: {\r
54 anchor: '100%'\r
55 }\r
56 },\r
57 \r
58 items: [{\r
59 title: 'Basic Information',\r
60 reference: 'basicInfo',\r
61 \r
62 // configs for BasicForm\r
63 api: {\r
64 // The server-side method to call for load() requests\r
65 load: 'Profile.getBasicInfo',\r
66 \r
67 // The server-side must mark the submit handler as a 'formHandler'\r
68 submit: 'Profile.updateBasicInfo'\r
69 },\r
70 \r
71 // specify the order for the passed params\r
72 paramOrder: ['uid', 'foo'],\r
73 \r
74 buttons: [{\r
75 text: 'Submit',\r
76 listeners: {\r
77 click: 'onBasicInfoSubmit'\r
78 }\r
79 }],\r
80 \r
81 items: [{\r
82 fieldLabel: 'Name',\r
83 name: 'name'\r
84 }, {\r
85 fieldLabel: 'Email',\r
86 msgTarget: 'side',\r
87 vtype:'email',\r
88 name: 'email'\r
89 }, {\r
90 fieldLabel: 'Company',\r
91 name: 'company'\r
92 }]\r
93 }, {\r
94 title: 'Phone Numbers',\r
95 reference: 'phoneInfo',\r
96 \r
97 api: {\r
98 // Note that the method names are quoted in all forms of this\r
99 // example. This makes use of thelazy method resolution feature\r
100 // that is built in Ext Direct form actions, as well as Direct\r
101 // data proxy. When KitchenSink.view.direct.Form class is defined\r
102 // upon initial application load, the Profile.getPhoneInfo\r
103 // function does not exist yet; it will be created later when\r
104 // Form API is received from the server and Form Provider is\r
105 // created. By quoting the function name we are deferring\r
106 // function resolution until the time it is first used, which\r
107 // happens when the form is loaded. Form loading in turn is\r
108 // initiated from the Form ViewController that will initialize\r
109 // corresponding API first and only then load the form, thus\r
110 // ensuring correct processing order.\r
111 load: 'Profile.getPhoneInfo'\r
112 },\r
113 \r
114 paramOrder: ['uid'],\r
115 \r
116 items: [{\r
117 fieldLabel: 'Office',\r
118 name: 'office'\r
119 }, {\r
120 fieldLabel: 'Cell',\r
121 name: 'cell'\r
122 }, {\r
123 fieldLabel: 'Home',\r
124 name: 'home'\r
125 }]\r
126 }, {\r
127 title: 'Location Information',\r
128 reference: 'locationInfo',\r
129 \r
130 api: {\r
131 load: 'Profile.getLocationInfo'\r
132 },\r
133 \r
134 paramOrder: ['uid'],\r
135 \r
136 items: [{\r
137 fieldLabel: 'Street',\r
138 name: 'street'\r
139 },{\r
140 fieldLabel: 'City',\r
141 name: 'city'\r
142 },{\r
143 fieldLabel: 'State',\r
144 name: 'state'\r
145 },{\r
146 fieldLabel: 'Zip',\r
147 name: 'zip'\r
148 }]\r
149 }]\r
150});\r