Page 1 of 1

Save report error with "this.value is null"

Posted: Tue Nov 15, 2016 1:47 am
by 303248153
I use code like this

Code: Select all

			designer.onSaveReport = function (event) {
				var jsonStr = event.report.saveToJsonString();
				console.log(jsonStr);
			}
But console output is
this.value is null
undefined

If I use event.report.saveToJsonInternal
I will see TypeError: this.value is null

Where is wrong? Your product are very buggy. :(

Re: Save report error with "this.value is null"

Posted: Tue Nov 15, 2016 2:46 am
by 303248153
After some digging I see the error is from
i.addPropertyJObject("Styles", this.styles.saveToJsonObject(t))
in function ut.prototype.saveToJsonInternal

Please tell me how to fix it :oops:

Re: Save report error with "this.value is null"

Posted: Tue Nov 15, 2016 3:14 am
by 303248153
And more digging,

This code work.
var report = new Stimulsoft.Report.StiReport();
report.saveToJsonString();

This code not work.
var report = new Stimulsoft.Report.StiReport();
designer.report = report;
report.saveToJsonString(); // this.value is null

Looks like report get **** after assign to desginer.

Re: Save report error with "this.value is null"

Posted: Wed Nov 16, 2016 10:35 am
by HighAley
Hello.

Sorry, we can't reproduce the issue on our latest build.
Could you try it and let us know about result?
If you still get the issue, please, send us a working sample that will help us to reproduce the issue.

Thank you.

Re: Save report error with "this.value is null"

Posted: Tue Nov 22, 2016 7:19 am
by 303248153
Resolved.
The reason is I'm using stireport with vue.js, and vue.js will wrap properties in designer object with getter and setter, that make `designer.styles.saveToJsonObject()` return an object not null, and that make Stimulsoft.Base.StiJson.addPropertyJObject failed.
I fixed this problem by save designer to a global clean javascript object.
Instead of

Code: Select all

vm.designer = createDesigner();
I use

Code: Select all

window.stiInstances = {};
window.stiInstances.designer = createDesigner();

Re: Save report error with "this.value is null"

Posted: Tue Nov 22, 2016 2:30 pm
by HighAley
Hello.

Great! Thank you for sharing your solution.