Reputation: 8935
I need to download a file from a grid using a button in window. In order to send the filter parameters I use store.load however it doesn't download the file but it tries to read it. Is there any solution?
store.load({
params: {
startExel: parseInt(Ext.getCmp('startE').getValue())
}
});
startExel is an extra parameter in order to indicate that I want to download an Excel file.
Upvotes: 0
Views: 2359
Reputation: 808
I don't think its possible to do this by simple configuration changes. Because stores are loaded via AJAX calls.
Here is an idea for you:
Return a JSON
object with file download url as the response to store load request. Not the actual file contents.
{ success = false, url='...'}
In client side handle the store load failure then identify and extract the returned url. You may have to tweak reader configuration a little.
Call window.open(url)
to initiate the file download.
See this question from SO.
Upvotes: 1
Reputation: 17860
On the server end when returning the file include the following header:
Content-disposition: attachment
Upvotes: 0