app.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @example Floating Panel
  3. *
  4. * Demonstrates some commonly used features of floating components
  5. */
  6. Ext.require('Ext.tab.Panel');
  7. Ext.require('Ext.window.MessageBox');
  8. Ext.onReady(function() {
  9. var panel = Ext.create('Ext.panel.Panel', {
  10. width: 200,
  11. height: 100,
  12. floating: true,
  13. draggable: true,
  14. title: 'Test',
  15. html: 'Test Panel'
  16. });
  17. Ext.create('Ext.button.Button', {
  18. renderTo: Ext.getBody(),
  19. margin: 10,
  20. text: 'Show Panel',
  21. handler: function() {
  22. panel.show(); // show the panel
  23. }
  24. });
  25. Ext.create('Ext.button.Button', {
  26. renderTo: Ext.getBody(),
  27. margin: 10,
  28. text: 'Hide Panel',
  29. handler: function() {
  30. panel.hide(); // hide the panel
  31. }
  32. });
  33. Ext.create('Ext.button.Button', {
  34. renderTo: Ext.getBody(),
  35. margin: 10,
  36. text: 'Align Panel to this button',
  37. handler: function() {
  38. // align the top left corner of the panel to the bottom right corner
  39. // of this button, offset by 3 pixels in each direction
  40. panel.alignTo(this.getEl(), 'tl-br', [3, 3]);
  41. }
  42. });
  43. Ext.create('Ext.button.Button', {
  44. renderTo: Ext.getBody(),
  45. margin: 10,
  46. text: 'Center Panel',
  47. handler: function() {
  48. panel.center(); // center the panel
  49. }
  50. });
  51. });