There were several Ext 3 examples available, however. So I ported and enhanced one that I found out there for your enjoyment.
Here’s the result, which I implemented as an override to the grid control. Calling it’s rather quite simple. Just invoke the grid’s downloadExcelXml() method.
1
2
3
4
5
6
7
8
| { xtype: 'button' , flex: 1, text: 'Download to Excel' , handler: function (b, e) { b.up( 'grid' ).downloadExcelXml(); } } |
Converting over the Ext 3 code and enhancing it to supply a suggested filename using a new Google Chrome trick, wasn’t quite so simple:
You can play around with the code on Sencha Fiddle:
https://fiddle.sencha.com/#fiddle/17j
https://fiddle.sencha.com/#fiddle/17j
Comments
Post a Comment