Save report error with "this.value is null"

Stimulsoft Reports.JS discussion
Post Reply
303248153
Posts: 15
Joined: Mon Nov 14, 2016 4:13 am

Save report error with "this.value is null"

Post 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. :(
303248153
Posts: 15
Joined: Mon Nov 14, 2016 4:13 am

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

Post 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:
303248153
Posts: 15
Joined: Mon Nov 14, 2016 4:13 am

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

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

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

Post 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.
303248153
Posts: 15
Joined: Mon Nov 14, 2016 4:13 am

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

Post 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();
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

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

Post by HighAley »

Hello.

Great! Thank you for sharing your solution.
Post Reply