SmartClient Version: v11.0p_2016-05-14/LGPL Development Only (built 2016-05-14)
Browser: Chrome, IE... doesn't seem to matter
Reference: http://www.smartclient.com/#export
What I'm trying to do: Use ListGrid.exportData() to download a csv representation of the grid.
What I've done:
1. Coded my server (.NET) to create a csv and return it as an attachment when the request is made. This seems to be working as I can see the response in Fiddler and it looks right, including the headers.
2. Created the following function and hooked it up to a button click.
What happens: The request is sent and the server creates the appropriate response (I think). From the console, here is the request:
... and here is part of the response:
which is good csv.... and from Fiddler, the headers contain
which seems right.
But the browser does not attempt to open or save the file. Instead, I get an isc warning dialog that says,
Obviously I don't want a JSON response and the server is not sending a JSON response. I want a csv attachement response which is what the server is returning but it seems like the grid is expecting a JSON response. The callback is never called.
Questions:
1. Is this supposed to work with LPGL? The showcase example indicates that Pro is required but makes it sound like that is only for a JSON response.
2. If so, what am I doing wrong? How can I tell the grid not to expect a JSON response?
Thanks
Browser: Chrome, IE... doesn't seem to matter
Reference: http://www.smartclient.com/#export
What I'm trying to do: Use ListGrid.exportData() to download a csv representation of the grid.
What I've done:
1. Coded my server (.NET) to create a csv and return it as an attachment when the request is made. This seems to be working as I can see the response in Fiddler and it looks right, including the headers.
2. Created the following function and hooked it up to a button click.
Code:
function ExportGrid(grid) {
grid.exportData({
exportAs: "csv"
, exportDisplay: "download"
, lineBreakStyle: "dos"
, exportToClient: false // needed for callback to work?
}, function (dsResponse, data, dsRequest) {
isc.say("Got response");
});
}
Code:
{
dataSource:"fise_FiseLog",
operationType:"fetch",
data:"{\n \"dataSource\":\"fise_FiseLog\", \n \"operationType\":\"fetch\", \n \"sortBy\":[\n \"-FiseLogId\"\n ], \n \"textMatchStyle\":\"substring\", \n \"data\":{\n }, \n \"oldValues\":null\n}",
sortBy:[
"-FiseLogId"
],
textMatchStyle:"substring",
showPrompt:false,
requestId:"fise_FiseLog$6277",
fallbackToEval:false,
exportAs:"csv",
exportDisplay:"download",
lineBreakStyle:"dos",
exportToClient:false,
exportRawValues:true,
exportPropertyIdentifier:"name",
exportFilename:"Results.csv",
downloadResult:false,
downloadToNewWindow:false,
lastClientEventThreadCode:"MUP5",
bypassCache:true,
dataProtocol:"postMessage",
isRestRequest:true,
dataFormat:"json",
contentType:"application/json"
}
Code:
"FiseLogId","358120","Source","YO00DBSD01","Interface","INFPC013","DateTime","5/20/2016 10:45:08 AM","LogSeverityId","5","Message","Status update: SSIS Package INFPC013_Create_FISCal_File set status to FILE_CREATED for interface file DGS_INFPC013_B7411_2016-05-20
Code:
Content-Disposition: attachment; filename=Result.csv
But the browser does not attempt to open or save the file. Instead, I get an isc warning dialog that says,
Error: server returned invalid JSON response
Questions:
1. Is this supposed to work with LPGL? The showcase example indicates that Pro is required but makes it sound like that is only for a JSON response.
2. If so, what am I doing wrong? How can I tell the grid not to expect a JSON response?
Thanks
Comment