panel.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. Ext.require([
  2. '*'
  3. ]);
  4. Ext.onReady(function() {
  5. var html = '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, '+
  6. 'porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, '+
  7. 'lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis '+
  8. 'vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>'+
  9. 'Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing '+
  10. 'eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt '+
  11. 'diam nec urna. Curabitur velit. Lorem ipsum dolor sit amet.</p>';
  12. var configs = [{
  13. title: 'Basic Panel',
  14. collapsible:true,
  15. width:400,
  16. html: html
  17. },{
  18. width: 320,
  19. height: 320,
  20. title: 'Masked Panel with a really long title',
  21. bodyStyle: "padding: 5px;",
  22. html: 'Some content',
  23. collapsible: true,
  24. collapseDirection: Ext.Component.DIRECTION_LEFT,
  25. listeners: {
  26. render: function(p){
  27. p.body.mask('Loading...');
  28. },
  29. delay: 50
  30. }
  31. },{
  32. width: 150,
  33. height: 150,
  34. unstyled: true,
  35. title: 'Panel with unstyled:true',
  36. bodyPadding: 0,
  37. html: 'Some content'
  38. },{
  39. width: 150,
  40. height: 150,
  41. border: false,
  42. frame: true,
  43. title: 'Panel with border:false',
  44. html: 'Some content'
  45. },{
  46. title: 'Framed panel: Width 280/Height 180',
  47. html: html,
  48. collapsible: true,
  49. frame: true,
  50. autoScroll: true,
  51. width: 280,
  52. height: 180
  53. },{
  54. title : 'Panel as child',
  55. width : 500,
  56. height: 400,
  57. layout: 'fit',
  58. bodyStyle: 'padding:5px',
  59. items: [
  60. {
  61. xtype: 'panel',
  62. border: false,
  63. layout: {
  64. type: 'vbox',
  65. align: 'stretch'
  66. },
  67. items: [
  68. {
  69. html: 'top, with no title',
  70. height: 100,
  71. margin: '0 0 5 0'
  72. },{
  73. xtype: 'panel',
  74. title: 'test',
  75. html: 'bottom',
  76. flex: 1
  77. }
  78. ]
  79. }
  80. ]
  81. },{
  82. title : 'Framed panel as child',
  83. width : 300,
  84. height: 100,
  85. html : null,
  86. layout: 'fit',
  87. items: [
  88. {
  89. xtype: 'panel',
  90. title: 'Framed panel',
  91. html : '123',
  92. frame: true
  93. }
  94. ]
  95. },{
  96. title : 'Framed panel with normal child',
  97. width : 300,
  98. height: 100,
  99. html : null,
  100. frame: true,
  101. layout: 'fit',
  102. items: [
  103. {
  104. xtype: 'panel',
  105. title: 'Non-framed child',
  106. html : 'Hello'
  107. }
  108. ]
  109. },{
  110. title: 'Width 180/No Height',
  111. animCollapse: true,
  112. collapsible: true,
  113. width: 180,
  114. html: html
  115. }];
  116. Ext.each(configs, function(config) {
  117. var element = Ext.getBody().createChild({cls: 'panel-container'});
  118. Ext.widget('panel', Ext.applyIf(config, {
  119. renderTo: element,
  120. bodyPadding: 7
  121. }));
  122. });
  123. });