Search for quite a long time, find some examples, because I am a beginner's sake mostly do not know how to use.
Study of the source code, get to now finally achieve the basic download. Fixed a small bug where a table could not be downloaded repeatedly, a bug that occurred using grid initialization
The following steps are documented: Maybe next time it works.
1. The download need to use the JS code, I have uploaded
http://download.csdn.net/detail/hu8471479/7281703
2. Add a reference to your HTML file, the path problem yourself, below is my path
3. At the beginning of the Ext.onready () of the JS code you want to use, add
Ext.Loader.setConfig ({enabled:true}); Ext.Loader.setPath (' Ext.ux.exporter ', ' ... /export/exporter '); Ext.require ([ ' Ext.ux.exporter.Exporter ' ]);
Set the namespace: Note the path
4. Use in the code, in the grid where you need to download the function of the appropriate place to join
Xtype: ' Exporterbutton ', //STORE:STORECOMPONENT:EXT.GETCMP (' gird_a ')
Here are two ways to initialize Excel, one to initialize with store, to use store's fields and data, because the fields in my store are in English, and the exported column names are in English so I'm not using this, I'm initializing it directly with a grid.
Here's what I'm modifying on the basis of someone else's code.
1. On line 40th of Exporter.js, changed to
var columns = Ext.Array.filter (Grid.columnManager.columns,
The original code in the first parameter there is grid.columns, and then I found that the dynamically generated grid after reconfigure columns placed in Columnmanager.columns, so change
2. In the Workbook.js 77.78 lines, add two words
This.styles=[];this.worksheets=[];
The above 2 lines of code for some initialization, or Excel each generation because the previous data is not emptied resulting in a malformed format
After the simple modification of the above can be freely exported to a grid, and support the custom field of the table export, that is, the export table display columns
Over here:
Custom field generated code has been improved, and the speed has increased by n times, see my previous article
Have a question can leave a message, discuss together, Http://blog.csdn.net/decoderworld