Guest User

Untitled

a guest
Jun 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <script type="text/javascript">
  2. Ext.onReady(function () {
  3. Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
  4.  
  5. var viewport = new Ext.Viewport({
  6. layout: 'border',
  7. items: [{
  8. region: 'west',
  9. id: 'west-panel',
  10. title: 'West',
  11. split: true,
  12. width: 200,
  13. minSize: 175,
  14. maxSize: 400,
  15. collapsible: true,
  16. margins: '0 0 0 5',
  17. layout: 'accordion',
  18. layoutConfig: {
  19. animate: true
  20. },
  21. contentEl: 'divMenu'
  22. },
  23. new Ext.Panel({
  24. region: 'center',
  25. id: 'mainPanel',
  26. layout: 'fit',
  27. html: ''
  28. })
  29. ]
  30. });
  31. });
  32.  
  33. function addItem() {
  34. var anagPanel = new Ext.Panel({
  35. layout: 'border',
  36. items: [{
  37. region: 'north',
  38. html: 'North',
  39. margins: '5 5 0 5',
  40. bodyStyle: 'padding:10px;',
  41. split: true,
  42. html: 'Some content'
  43. }, {
  44. plain: true,
  45. region: 'center',
  46. html: 'center'
  47. }]
  48. });
  49. }
  50.  
  51. // the above code removes all existing panel and child items/containers
  52. // just remove the whole if block if you don't want to remove any existing child containers
  53. if(Ext.getCmp('mainPanel').items != undefined){
  54. Ext.getCmp('mainPanel').items.each(function(item){
  55. Ext.getCmp('mainPanel').remove(item, true);
  56. });
  57. }
  58.  
  59. // following code is adding an extra panel
  60. Ext.getCmp('mainPanel').add(anagPanel);
  61. Ext.getCmp('mainPanel').doLayout();
  62. }
  63. </script>
  64. </head>
  65. <body>
  66. <script type="text/javascript" src="../shared/examples.js"></script><!-- EXAMPLES -->
  67. <div id="testPanel" style="border:1px solid aqua;height:0px;display:none;">
  68. <table style="border:1px solid red;width:100%;">
  69. <tr>
  70. <td>ciccio</td>
  71. </tr>
  72. </table>
  73. </div>
  74. <div id="divMenu">
  75. <a onclick="javascript:addItem()" href="#">add item</a>
  76. </div>
Add Comment
Please, Sign In to add comment