3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
7 // This example illustrates how to load a FormPanel or BasicForm through Ext.Direct.
9 Ext.onReady(function(){
10 // Notice that Direct requests will batch together if they occur
11 // within the enableBuffer delay period (in milliseconds).
12 // Slow the buffering down from the default of 10ms to 100ms
13 Ext.app.REMOTING_API.enableBuffer = 100;
14 Ext.Direct.addProvider(Ext.app.REMOTING_API);
16 // provide feedback for any errors
19 var basicInfo = new Ext.form.FormPanel({
20 // configs for FormPanel
21 title: 'Basic Information',
27 basicInfo.getForm().submit({
36 // configs apply to child items
37 defaults: {anchor: '-20'}, // provide some room on right for validation errors
38 defaultType: 'textfield',
47 fieldLabel: 'Company',
51 // configs for BasicForm
53 // The server-side method to call for load() requests
54 load: Profile.getBasicInfo,
55 // The server-side must mark the submit handler as a 'formHandler'
56 submit: Profile.updateBasicInfo
58 // specify the order for the passed params
59 paramOrder: ['uid', 'foo']
62 var phoneInfo = new Ext.form.FormPanel({
63 title: 'Phone Numbers',
66 load: Profile.getPhoneInfo
70 defaultType: 'textfield',
71 defaults: {anchor: '100%'},
84 var locationInfo = new Ext.form.FormPanel({
85 title: 'Location Information',
89 load: Profile.getLocationInfo
92 defaultType: 'textfield',
93 defaults: {anchor: '100%'},
109 var accordion = new Ext.Panel({
114 renderTo: Ext.getBody(),
118 items: [basicInfo, phoneInfo, locationInfo]
121 // load the forms (notice the load requests will get batched together)
122 basicInfo.getForm().load({
123 // pass 2 arguments to server side getBasicInfo method (len=2)
130 phoneInfo.getForm().load({
136 // defer this request just to simulate the request not getting batched
137 // since it exceeds to configured buffer
139 locationInfo.getForm().load({
147 TestAction.doEcho('sample');