/ext-4.1.0_b3/examples/form/vbox-form.js

https://bitbucket.org/srogerf/javascript · JavaScript · 87 lines · 80 code · 7 blank · 0 comment · 0 complexity · 161ff5cef00304cbe7d7587226855cfb MD5 · raw file

  1. Ext.Loader.setConfig({enabled: true});
  2. Ext.Loader.setPath('Ext.ux', '../ux/');
  3. Ext.require([
  4. 'Ext.form.*',
  5. 'Ext.window.Window',
  6. 'Ext.data.*',
  7. 'Ext.ux.FieldReplicator'
  8. ]);
  9. Ext.onReady(function() {
  10. var form = Ext.create('Ext.form.Panel', {
  11. plain: true,
  12. border: 0,
  13. bodyPadding: 5,
  14. url: 'save-form.php',
  15. fieldDefaults: {
  16. labelWidth: 55,
  17. anchor: '100%'
  18. },
  19. layout: {
  20. type: 'vbox',
  21. align: 'stretch' // Child items are stretched to full width
  22. },
  23. items: [{
  24. xtype: 'combo',
  25. store: Ext.create('Ext.data.ArrayStore', {
  26. fields: [ 'email' ],
  27. data: [
  28. ['test@example.com'],
  29. ['someone@example.com'],
  30. ['someone-else@example.com']
  31. ]
  32. }),
  33. displayField: 'email',
  34. plugins: [ Ext.ux.FieldReplicator ],
  35. fieldLabel: 'Send To',
  36. queryMode: 'local',
  37. selectOnTab: false,
  38. name: 'to'
  39. }, {
  40. xtype: 'textfield',
  41. fieldLabel: 'Subject',
  42. name: 'subject'
  43. }, {
  44. xtype: 'textarea',
  45. fieldLabel: 'Message text',
  46. hideLabel: true,
  47. name: 'msg',
  48. style: 'margin:0', // Remove default margin
  49. flex: 1 // Take up all *remaining* vertical space
  50. }]
  51. });
  52. var win = Ext.create('Ext.window.Window', {
  53. title: 'Compose message',
  54. collapsible: true,
  55. animCollapse: true,
  56. maximizable: true,
  57. width: 750,
  58. height: 500,
  59. minWidth: 300,
  60. minHeight: 200,
  61. layout: 'fit',
  62. items: form,
  63. dockedItems: [{
  64. xtype: 'toolbar',
  65. dock: 'bottom',
  66. ui: 'footer',
  67. layout: {
  68. pack: 'center'
  69. },
  70. items: [{
  71. minWidth: 80,
  72. text: 'Send'
  73. },{
  74. minWidth: 80,
  75. text: 'Cancel'
  76. }]
  77. }]
  78. });
  79. win.show();
  80. });