desinger.onSaveReport post json raise error
desinger.onSaveReport post json raise error
onSaveReport event
//ajax post report file to server and save,
function test(e) {
var data = { "id": e.report.reportName, "fn": e.report.saveToJsonString() };
$.ajax({
url: "/Report/SaveReport.ashx",
dataType: 'json',
async: false,
type: 'get',
data: data,
complete: function (msg) {
},
success: function (data) {
alert("success");
},
error: function (a, b, c) {
alert(a.responseText);
}
});
}
//event
var options = new Stimulsoft.Designer.StiDesignerOptions();
options.appearance.fullScreenMode = true;
var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
designer.onSaveReport = function (e) {
test(e);
};
//when run test(e) method designer show an error
test@http://localhost:60468/BaseUI/ClsReport.js:33:9 ClsReport/this.designReport/designer.onSaveReport@http://localhost:60468/BaseUI/ClsReport.js:60:13 o
ClsReport is the class to opt Report
the method test(e) call by button click event success
//ajax post report file to server and save,
function test(e) {
var data = { "id": e.report.reportName, "fn": e.report.saveToJsonString() };
$.ajax({
url: "/Report/SaveReport.ashx",
dataType: 'json',
async: false,
type: 'get',
data: data,
complete: function (msg) {
},
success: function (data) {
alert("success");
},
error: function (a, b, c) {
alert(a.responseText);
}
});
}
//event
var options = new Stimulsoft.Designer.StiDesignerOptions();
options.appearance.fullScreenMode = true;
var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
designer.onSaveReport = function (e) {
test(e);
};
//when run test(e) method designer show an error
test@http://localhost:60468/BaseUI/ClsReport.js:33:9 ClsReport/this.designReport/designer.onSaveReport@http://localhost:60468/BaseUI/ClsReport.js:60:13 o
ClsReport is the class to opt Report
the method test(e) call by button click event success
Re: desinger.onSaveReport post json raise error
Hello.
Sorry, this information is not enough to help you.
Could you send us a working sample to reproduce your issue?
Thank you.
Sorry, this information is not enough to help you.
Could you send us a working sample to reproduce your issue?
Thank you.
Re: desinger.onSaveReport post json raise error
Hello,
Please specify the following:
1. Which line is number 33, and which line is number 60 in the your code fragment?
2. Does the error is reproduced, if you change the code as follows:
var data = { "id": e.report.reportName, "fn": { } };
Thank you.
Please specify the following:
1. Which line is number 33, and which line is number 60 in the your code fragment?
2. Does the error is reproduced, if you change the code as follows:
var data = { "id": e.report.reportName, "fn": { } };
Thank you.
Re: desinger.onSaveReport post json raise error
save report mrt to jsonString,and use $.ajax() method send to server,server save the json string to file.
line 33 is call $.ajax.
server code is here
line 33 is call $.ajax.
server code is here
Code: Select all
public void ProcessRequest(HttpContext context)
{
string action = context.Request["Action"];
string fn = context.Request["fn"];
string id = context.Request["id"];
var reportPath = context.Server.MapPath(string.Format("Report/{0}.mrt", id));
if (File.Exists(reportPath))
{
File.Delete(reportPath);
}
byte[] myByte = System.Text.Encoding.UTF8.GetBytes(fn);
try {
using (FileStream fs = new FileStream(reportPath, FileMode.CreateNew, FileAccess.Write))
{
fs.Write(myByte, 0, myByte.Length);
fs.Flush();
}
context.Response.Write("1");
}
catch
{
context.Response.Write("0");
}
}
Re: desinger.onSaveReport post json raise error
Hello,
Please change the code for testing as shown below:
var data = { "id": "report-name", "fn": "report-data" };
The error reproduced in this case?
This is necessary in order to find - an error occurs due to the json report or in the data transmission method.
Thank you.
Please change the code for testing as shown below:
var data = { "id": "report-name", "fn": "report-data" };
The error reproduced in this case?
This is necessary in order to find - an error occurs due to the json report or in the data transmission method.
Thank you.
Re: desinger.onSaveReport post json raise error
the method test() is called by a button click function,run right.but test() called by onSaveReport event,designer raise an error as before.if cancel $.ajax() code in test() function,designer never raise error again
Re: desinger.onSaveReport post json raise error
Hello Pall,
We are unable to reproduce the problem. Please see our test project:
Please make changes to this project that we were able to reproduce the problem.
Thank you.
We are unable to reproduce the problem. Please see our test project:
Please make changes to this project that we were able to reproduce the problem.
Thank you.
Re: desinger.onSaveReport post json raise error
test-website.zip is ok.
Re: desinger.onSaveReport post json raise error
Hello.
We are always glad to help you.
Let us know if you need any additional help.
Thank you.
We are always glad to help you.
Let us know if you need any additional help.
Thank you.