ExportExcelButton.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Ext.define('erp.view.core.button.ExportExcelButton',{
  2. extend: 'Ext.Button',
  3. alias: 'widget.erpExportExcelButton',
  4. iconCls: 'x-button-icon-excel',
  5. style: {
  6. marginLeft: '10px'
  7. },
  8. width: 100,
  9. exportCaller:null,
  10. id:'exportexcel',
  11. cls: 'x-btn-gray',
  12. bodyStyle: 'background: transparent no-repeat 0 0; border:0;background-color:#f0f0f0',
  13. disabled: false,
  14. text:'导入Excel',
  15. menu: [{
  16. iconCls: 'main-msg',
  17. text: '下载模板',
  18. cls: ' ',
  19. scope: this,
  20. handler: function(btn){
  21. var form=btn.parentMenu.floatParent.ownerCt.ownerCt;
  22. var botton=Ext.getCmp('exportexcel');
  23. form.BaseUtil.createExcel(botton.exportCaller, 'detailgrid','1=2');
  24. }
  25. },{
  26. text: '导入EXCEL',
  27. scope: this,
  28. id:'importexcel',
  29. alias: 'widget.erpImportExcelButton',
  30. xtype:'form',
  31. iconCls: 'main-msg',
  32. cls: ' ',
  33. height: 23,
  34. bodyStyle: 'background: transparent no-repeat 0 0;border: none;',
  35. items: [{
  36. xtype: 'filefield',
  37. name: 'file',
  38. id:'exportfield',
  39. buttonOnly: true,
  40. hideLabel: true,
  41. width: 80,
  42. height: 17,
  43. buttonConfig: {
  44. iconCls: 'x-button-icon-excel',
  45. text: '导入EXCEL数据'
  46. },
  47. id:'excelfile'
  48. }]
  49. }],
  50. initComponent : function(){
  51. this.callParent(arguments);
  52. },
  53. listeners: {
  54. afterrender: function(){
  55. this.grid = this.ownerCt.ownerCt;
  56. }
  57. }
  58. });