]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/direct/FormController.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / direct / FormController.js
CommitLineData
6527f429
DM
1Ext.define('KitchenSink.view.direct.FormController', {\r
2 extend: 'KitchenSink.view.direct.DirectVC',\r
3 alias: 'controller.directform',\r
4 \r
5 config: {\r
6 /*\r
7 * Note that we're overriding the default URI here\r
8 * to load the API that is specific to Form handling\r
9 * and initialize it as a separate Ext Direct Provider.\r
10 */\r
11 apiUrl: 'data/direct/api.php?form=true',\r
12 \r
13 /*\r
14 * Note that Direct requests will batch together if they occur\r
15 * within the enableBuffer delay period (in milliseconds).\r
16 * Slow the buffering down from the default of 10ms to 100ms\r
17 * for this Provider only.\r
18 */\r
19 providerCfg: {\r
20 enableBuffer: 100\r
21 }\r
22 },\r
23 \r
24 finishInit: function() {\r
25 var locationForm;\r
26 \r
27 // Load the forms. You can use Network tab in browser debugger\r
28 // to look into the data packet sent to the server; notice\r
29 // that basicInfo and phoneInfo requests are batched together.\r
30 this.lookupReference('basicInfo').getForm().load({\r
31 // Pass 2 arguments to server side getBasicInfo method (len=2)\r
32 params: {\r
33 foo: 'bar',\r
34 uid: 42\r
35 }\r
36 });\r
37 \r
38 this.lookupReference('phoneInfo').getForm().load({\r
39 params: {\r
40 uid: 5\r
41 }\r
42 });\r
43 \r
44 locationForm = this.lookupReference('locationInfo').getForm();\r
45 \r
46 // Defer loading this form to simulate the request\r
47 // not getting batched since it exceeds enableBuffer timeout\r
48 Ext.Function.defer(function() {\r
49 locationForm.load({\r
50 params: {\r
51 uid: 6\r
52 }\r
53 });\r
54 }, 200);\r
55 },\r
56 \r
57 onBasicInfoSubmit: function() {\r
58 var form = this.lookupReference('basicInfo').getForm();\r
59 \r
60 if (form.isValid()) {\r
61 form.submit({\r
62 foo: 'baz',\r
63 uid: 43\r
64 });\r
65 }\r
66 }\r
67});\r