anchoring.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Ext.require([
  2. 'Ext.form.*',
  3. 'Ext.window.Window'
  4. ]);
  5. Ext.onReady(function() {
  6. var form = Ext.create('Ext.form.Panel', {
  7. border: false,
  8. fieldDefaults: {
  9. labelWidth: 55
  10. },
  11. url: 'save-form.php',
  12. defaultType: 'textfield',
  13. bodyPadding: 5,
  14. items: [{
  15. fieldLabel: 'Send To',
  16. name: 'to',
  17. anchor:'100%' // anchor width by percentage
  18. },{
  19. fieldLabel: 'Subject',
  20. name: 'subject',
  21. anchor: '100%' // anchor width by percentage
  22. }, {
  23. xtype: 'textarea',
  24. hideLabel: true,
  25. name: 'msg',
  26. anchor: '100% -47' // anchor width by percentage and height by raw adjustment
  27. }]
  28. });
  29. var win = Ext.create('Ext.window.Window', {
  30. title: 'Resize Me',
  31. width: 500,
  32. height:300,
  33. minWidth: 300,
  34. minHeight: 200,
  35. layout: 'fit',
  36. plain: true,
  37. items: form,
  38. buttons: [{
  39. text: 'Send'
  40. },{
  41. text: 'Cancel'
  42. }]
  43. });
  44. win.show();
  45. });