ExportExcelButton.js 1.5 KB

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