I have a grid in ext-js with a “Download” button so that the user can download a file representation of that grid that I will create on the fly when the button is pushed.
But I don’t know by what mechanism in EXT-JS I can trigger this download. Not sure if EXT-JS has some helper functions, or if you just use straight javascript (in which case how do you get down to the internals to do it in EXT-JS?)
What’s the best approach to trigger this download from the button handler function?
In ExtJS Button class has an href property that can be set to trigger an HTTP GET of the resource you are trying to fetch.
EDIT: after the clarification of what you are trying to do here is what you need:
Data on the URL: http://en.wikipedia.org/wiki/Data_URI_scheme
This trick makes your browser think it needs to download a file. You have to produce the data on the client side. There are some plugins that work this way: http://www.sencha.com/forum/showthread.php?146348-ExtJS-4-Grid-Printer-Plugin
Another plugin uses a different method: https://github.com/iwiznia/Ext.ux.Exporter