PortalPanel.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Ext.define('erp.view.common.sysinit.PortalPanel', {
  2. extend: 'Ext.panel.Panel',
  3. alias: 'widget.portalpanel',
  4. cls: 'x-portal',
  5. bodyCls: 'x-portal-body',
  6. autoScroll: true,
  7. manageHeight: false,
  8. defaultType:'panel',
  9. initComponent : function() {
  10. var me = this;
  11. this.layout = {
  12. type : 'column'
  13. };
  14. this.callParent();
  15. this.addEvents({
  16. validatedrop: true,
  17. beforedragover: true,
  18. dragover: true,
  19. beforedrop: true,
  20. drop: true
  21. });
  22. },
  23. beforeLayout: function() {
  24. var items = this.layout.getLayoutItems(),
  25. len = items.length,
  26. firstAndLast = ['x-portal-column-first', 'x-portal-column-last'],
  27. i, item, last;
  28. for (i = 0; i < len; i++) {
  29. item = items[i];
  30. item.columnWidth = 1 / len;
  31. last = (i == len-1);
  32. if (!i) {
  33. if (last) {
  34. item.addCls(firstAndLast);
  35. } else {
  36. item.addCls('x-portal-column-first');
  37. item.removeCls('x-portal-column-last');
  38. }
  39. } else if (last) {
  40. item.addCls('x-portal-column-last');
  41. item.removeCls('x-portal-column-first');
  42. } else {
  43. item.removeCls(firstAndLast);
  44. }
  45. }
  46. return this.callParent(arguments);
  47. },
  48. initEvents : function(){
  49. this.callParent();
  50. //this.dd = Ext.create('Ext.app.PortalDropZone', this, this.dropConfig);
  51. },
  52. beforeDestroy : function() {
  53. if (this.dd) {
  54. this.dd.unreg();
  55. }
  56. this.callParent();
  57. }
  58. });