MainContainerWrap.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Ext.define('saas.view.main.MainContainerWrap', {
  2. extend: 'Ext.container.Container',
  3. xtype: 'maincontainerwrap',
  4. // requires : [
  5. // 'Ext.layout.container.HBox'
  6. // ],
  7. id: 'main-view-detail-wrap',
  8. reference: 'mainContainerWrap',
  9. flex: 1,
  10. layout: 'border',
  11. // layout: {
  12. // type: 'hbox',
  13. // align: 'stretchmax',
  14. // // Tell the layout to animate the x/width of the child items.
  15. // animate: true,
  16. // animatePolicy: {
  17. // x: true,
  18. // width: true
  19. // }
  20. // },
  21. items: [
  22. {
  23. xtype: 'treelist',
  24. region: 'west',
  25. reference: 'navigationTreeList',
  26. itemId: 'navigationTreeList',
  27. ui: 'nav',
  28. bind: '{navItems}',
  29. width: 250,
  30. expanderFirst: false,
  31. expanderOnly: false,
  32. floatLeafItems: true,
  33. listeners: {
  34. itemClick: 'onNavigationTreeItemClick'
  35. }
  36. },
  37. {
  38. xtype: 'tabpanel',
  39. region: 'center',
  40. flex: 1,
  41. id:'main-tab-panel',
  42. reference: 'mainTabPanel',
  43. cls: 'main-right-tabpanel',
  44. itemId: 'contentPanel',
  45. defaults: {
  46. closable: true,
  47. margin: 10
  48. },
  49. items: [
  50. {
  51. xtype: 'home',
  52. title: '首页',
  53. closable: false
  54. }
  55. ]
  56. }
  57. ],
  58. beforeLayout : function() {
  59. // We setup some minHeights dynamically to ensure we stretch to fill the height
  60. // of the viewport minus the top toolbar
  61. var me = this,
  62. height = Ext.Element.getViewportHeight() - 64, // offset by topmost toolbar height
  63. // We use itemId/getComponent instead of "reference" because the initial
  64. // layout occurs too early for the reference to be resolved
  65. navTree = me.getComponent('navigationTreeList');
  66. me.minHeight = height;
  67. me.maxHeight = height;
  68. navTree.setStyle({
  69. 'min-height': height + 'px',
  70. 'max-height': height + 'px'
  71. });
  72. me.callParent(arguments);
  73. }
  74. });