Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. // This example illustrates how to load a FormPanel or BasicForm through Ext.Direct.
  8. Ext.onReady(function(){
  9. // Notice that Direct requests will batch together if they occur
  10. // within the enableBuffer delay period (in milliseconds).
  11. // Slow the buffering down from the default of 10ms to 100ms
  12. Ext.app.REMOTING_API.enableBuffer = 100;
  13. Ext.Direct.addProvider(Ext.app.REMOTING_API);
  14. // provide feedback for any errors
  15. Ext.QuickTips.init();
  16. var basicInfo = new Ext.form.FormPanel({
  17. // configs for FormPanel
  18. title: 'Basic Information',
  19. border: false,
  20. padding: 10,
  21. buttons:[{
  22. text: 'Submit',
  23. handler: function(){
  24. basicInfo.getForm().submit({
  25. params: {
  26. foo: 'bar',
  27. uid: 34
  28. }
  29. });
  30. }
  31. }],
  32. // configs apply to child items
  33. defaults: {anchor: '-20'}, // provide some room on right for validation errors
  34. defaultType: 'textfield',
  35. items: [{
  36. fieldLabel: 'Name',
  37. name: 'name'
  38. },{
  39. fieldLabel: 'Email',
  40. msgTarget: 'side',
  41. name: 'email'
  42. },{
  43. fieldLabel: 'Company',
  44. name: 'company'
  45. }],
  46. // configs for BasicForm
  47. api: {
  48. // The server-side method to call for load() requests
  49. load: Profile.getBasicInfo,
  50. // The server-side must mark the submit handler as a 'formHandler'
  51. submit: Profile.updateBasicInfo
  52. },
  53. // specify the order for the passed params
  54. paramOrder: ['uid', 'foo']
  55. });
  56. var phoneInfo = new Ext.form.FormPanel({
  57. title: 'Phone Numbers',
  58. border: false,
  59. api: {
  60. load: Profile.getPhoneInfo
  61. },
  62. padding: 10,
  63. paramOrder: ['uid'],
  64. defaultType: 'textfield',
  65. defaults: {anchor: '100%'},
  66. items: [{
  67. fieldLabel: 'Office',
  68. name: 'office'
  69. },{
  70. fieldLabel: 'Cell',
  71. name: 'cell'
  72. },{
  73. fieldLabel: 'Home',
  74. name: 'home'
  75. }]
  76. });
  77. var locationInfo = new Ext.form.FormPanel({
  78. title: 'Location Information',
  79. border: false,
  80. padding: 10,
  81. api: {
  82. load: Profile.getLocationInfo
  83. },
  84. paramOrder: ['uid'],
  85. defaultType: 'textfield',
  86. defaults: {anchor: '100%'},
  87. items: [{
  88. fieldLabel: 'Street',
  89. name: 'street'
  90. },{
  91. fieldLabel: 'City',
  92. name: 'city'
  93. },{
  94. fieldLabel: 'State',
  95. name: 'state'
  96. },{
  97. fieldLabel: 'Zip',
  98. name: 'zip'
  99. }]
  100. });
  101. var accordion = new Ext.Panel({
  102. layout: 'accordion',
  103. layoutConfig: {
  104. autoWidth : false
  105. },
  106. renderTo: Ext.getBody(),
  107. title: 'My Profile',
  108. width: 300,
  109. height: 240,
  110. items: [basicInfo, phoneInfo, locationInfo]
  111. });
  112. // load the forms (notice the load requests will get batched together)
  113. basicInfo.getForm().load({
  114. // pass 2 arguments to server side getBasicInfo method (len=2)
  115. params: {
  116. foo: 'bar',
  117. uid: 34
  118. }
  119. });
  120. phoneInfo.getForm().load({
  121. params: {
  122. uid: 5
  123. }
  124. });
  125. // defer this request just to simulate the request not getting batched
  126. // since it exceeds to configured buffer
  127. (function(){
  128. locationInfo.getForm().load({
  129. params: {
  130. uid: 5
  131. }
  132. });
  133. }).defer(200);
  134. // rpc call
  135. TestAction.doEcho('sample');
  136. });