With some investigation on internet, this requirement actually existed for a long time, there are 2 main thread on sencha forum:
- Leverage document data location: set document URL to BASE64 encoded data like: data:application/vnd.ms-excel;base64,...
- Cons: the download file cannot be customized, and there are some limitations on encoding UTF-8 to BASE64
- Cons: need some work on server side, the code here made it works on JSP.
- Pros: No server side work, user can choose the file name just like a normal download.
- Cons: depends on flash object.
My version of Ext.ux.Exporter actually forked the version who use Downloadify, and fixed some defects to make it works on ExtJS 4.1.1a. Here is the code to use it:In my implementation, I didn't take time to resolve the excel format issue, instead I use CSV format as default format. What I need is not to keep the exact style when load. I need further processing on data, and a CSV file can fulfill my requirements perfectly.
- include script files in html file:
- in docedItems list of grid panel, generally on a toolbar, add an item as follows::