saveDocumentToJsonString doesnt save changes from editable report

Stimulsoft Reports.JS discussion
Post Reply
angelcalvasp
Posts: 25
Joined: Fri Nov 10, 2017 9:48 pm

saveDocumentToJsonString doesnt save changes from editable report

Post by angelcalvasp »

I seem to be having a technical problem when exporting using the following method

var jsonString = report.saveDocumentToJsonString();

I have created an editable report, and when I use that method to save the document in json string It doesn’t return the report with the edited changes, is there something I’m missing that I have to do previous to calling that method?

I am using the latest version
Lech Kulikowski
Posts: 7289
Joined: Tue Mar 20, 2018 5:34 am

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by Lech Kulikowski »

Hello,

We need a sample project to reproduce the issue and provide the solution for you.

Thank you.
angelcalvasp
Posts: 25
Joined: Fri Nov 10, 2017 9:48 pm

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by angelcalvasp »

I have attached a sample project
Attachments
SampleStimulsoft.zip
(5.33 MiB) Downloaded 269 times
Lech Kulikowski
Posts: 7289
Joined: Tue Mar 20, 2018 5:34 am

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by Lech Kulikowski »

Hello,

You can use the following code:

Code: Select all

function updateFormDataHazardReport() {
    var report = viewer.report;
    Stimulsoft.Viewer.StiEditableFieldsHelper.applyEditableFieldsToReport(report, viewer.jsObject.reportParams.editableParameters);
    var updatedjsonString = report.saveDocumentToJsonString();
    ...
Thank you.
angelcalvasp
Posts: 25
Joined: Fri Nov 10, 2017 9:48 pm

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by angelcalvasp »

Thank you
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by Andrew »

You are welcome!
angelcalvasp
Posts: 25
Joined: Fri Nov 10, 2017 9:48 pm

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by angelcalvasp »

Hello, is there a method so the changes are applied to the datasource so I could read its changed values from there?

viewer.jsObject.reportParams.editableParameters <= this doesnt help me for my new venture since I don't know which field actually changed
Lech Kulikowski
Posts: 7289
Joined: Tue Mar 20, 2018 5:34 am

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
angelcalvasp
Posts: 25
Joined: Fri Nov 10, 2017 9:48 pm

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by angelcalvasp »

So after I used this method Stimulsoft.Viewer.StiEditableFieldsHelper.applyEditableFieldsToReport(report, viewer.jsObject.reportParams.editableParameters);
I thought I could read the updated values from the DataSource, but they still have the old values
What method do I use, so that the datasource values reflect what has been modified
Lech Kulikowski
Posts: 7289
Joined: Tue Mar 20, 2018 5:34 am

Re: saveDocumentToJsonString doesnt save changes from editable report

Post by Lech Kulikowski »

Hello,

Data source does not change, the only value in the editable field, in the Text component.

Thank you.
Post Reply