-
7 Jan 2013 8:22 AM #1
Unanswered: ExtJS: Stream OpenXML document to new window
Unanswered: ExtJS: Stream OpenXML document to new window
I will be using OpenXML to generate Powerpoint Presentations based on "scores" data POSTed in some way from an Ext.gridPanel (which I have got to work)
I am using an MVC C# FileResult to generate my presentation:
[HttpPost]
public FileResult Report(GridScores scores)
{
// OpenXml code would go here but I am returning a demo PPT file as a proof of concept to make this example shorter
// return GeneratePresentation(scores);
return File(@"C:\Temp\Demo.ppt", "application/vnd.ms-powerpoint", "NewFile.ppt");
}
I have a button on the gridPanels TBar. What ExtJS/Javascript code should I use to:- Open the the presentation in a new window?
- Present the user with a Download dialog to download the file?
-
7 Jan 2013 9:35 AM #2
You can use a Form object and specify a target in the submit method, as shown below.
Code:someRenderedForm.submit({ url: 'someUrl', params: { someRequestParam: someValue }, method: 'POST', target: 'powerPointWindow' });
-
8 Jan 2013 12:43 PM #3
Ensuring "somevalue" is a JSON version of my grid data
Ensuring "somevalue" is a JSON version of my grid data
Thanks for this, I am so close, I just can't seem to to post the data for the grid successfully.
I have tried:
and alsoCode:var encodedData = Ext.encode(Ext.pluck(grid.getStore().data.items, 'data')); var form = new Ext.form.Panel(); form.submit({ url: '/mycontroller/report', params: encodedData, jsonSubmit: true, method: 'POST', target: '_blank' });
But my data is not read into MVC action.Code:var encodedData = Ext.encode(Ext.pluck(grid.getStore().data.items, 'data')); var form = new Ext.form.Panel(); form.submit({ url: '/mycontroller/report', params: {scores: encodedData}, jsonSubmit: true, method: 'POST', target: '_blank' });
Can you see what I am doing wrong?


Reply With Quote