Viewer and Designer

Stimulsoft Reports.JS discussion
Post Reply
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Viewer and Designer

Post by jpgb »

I have a modal with the viewer where the user can edit the report.

If the user opens one report and edits the report everything works great, the second time he opens the modal with a diferent report and tries to edit the report the designer doesnt work. Im only loading the base stimulsoft JS one time - the first time he opens the modal. If i load it everytime it works fine

It was working in a past version.

Is there a workaround?

Thanks in advance,
JB
Lech Kulikowski
Posts: 7291
Joined: Tue Mar 20, 2018 5:34 am

Re: Viewer and Designer

Post by Lech Kulikowski »

Hello,

Please send us a sample project which reproduces the issue for analysis

Thank you.
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Re: Viewer and Designer

Post by jpgb »

dont know if it helps...error in console:

VM670:38 Uncaught TypeError: Cannot read property 'style' of null
at Function.i.measureString (<anonymous>:38:209302)
at Function.m.getTextLinesAndWidths (<anonymous>:41:176273)
at Function.wt.writeText (<anonymous>:50:250868)
at Function.wt.saveComponentToString (<anonymous>:50:289828)
at Function.jo.getSvgContent (<anonymous>:18:80975)
at t.getComponent (<anonymous>:18:189741)
at t.getComponents (<anonymous>:18:189298)
at t.getPage (<anonymous>:18:189155)
at t.getPages (<anonymous>:18:188860)
at t.getReportToObject (<anonymous>:18:188665)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Viewer and Designer

Post by HighAley »

Hello,

What code do you use to show the report?
We need a sample that will let us to reproduce the issue.
Could you send us a simple project that will allow us to do this?

Thank you.
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Re: Viewer and Designer

Post by jpgb »

Firts time i load a report in the modal form and try to edit it everything is alright. Second time i call the modal form with the viewer an try to edit a diferent report this bug shows and the designer doesnt load completely. But in this second time if i open the same report it works....

It was working with an older version (dont recall what version)

Besides that, i'm experiencing some group header simply disappering when i show show the report. If i refresh the page everything works again (and the group header shows)

Like i said Sitmulsoft is already loaded.

First in the modal form
<script src="js/reports/stimulsoft.viewer.js">

then create the viewer
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table;
options.appearance.allowChangeWindowTitle = false;

options.toolbar.showAboutButton=false;
options.toolbar.showBookmarksButton = false;
options.toolbar.showParametersButton = false;
options.toolbar.showFullScreenButton = false;
options.toolbar.showOpenButton = false;

options.height = "100%";
options.appearance.showTooltips = false;

viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
viewer.renderHtml("viewerContent");

Set the report:

viewer.showProcessIndicator();
viewer.jsObject.reportParams.bookmarksContent = null;
viewer.jsObject.InitializeBookmarksPanel();

setTimeout(function () {
Stimulsoft.System.Globalization.CultureInfo.currentCulture.numberFormat.numberDecimalSeparator = ",";
Stimulsoft.System.Globalization.CultureInfo.currentCulture.numberFormat.numberGroupSeparator = ".";
Stimulsoft.System.Globalization.CultureInfo.currentCulture.numberFormat.currencyDecimalSeparator = ",";
Stimulsoft.System.Globalization.CultureInfo.currentCulture.numberFormat.currencyGroupSeparator = ".";
Stimulsoft.System.Globalization.CultureInfo.currentCulture.numberFormat.currencySymbol = "€";

report = new Stimulsoft.Report.StiReport();
report.load(reportObject);
report.dictionary.databases.clear();
report.dictionary.dataSources.clear();
report.regData("Connection1", "Connection1", datajson);
report.dictionary.synchronize();
viewer.report = report;

viewer.jsObject.initAutoUpdateCache = function() { };
if (report.pages.getByIndex(0).orientation!=0) viewer.jsObject.postAction("Zoom75");

if (printpreview==1) {
var toolbarTable = viewer.jsObject.controls.toolbar.firstChild.lastElementChild.lastElementChild.lastElementChild.firstElementChild.firstChild.firstElementChild.firstElementChild;
toolbarTable.childNodes.item(0).hidden=true;
toolbarTable.childNodes.item(1).hidden=true;
toolbarTable.childNodes.item(2).hidden=true;
}

}, 50);

viewer.onDesignReport = function (event) {

if (designer==null) {
$.getScript("js/reports/stimulsoft.designer.js", function() {
loadDesigner(event.report);
});
} else {
viewer.visible= false;
designer.visible = true;
designer.report = event.report;
}

} ':'')
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Re: Viewer and Designer

Post by jpgb »

If in the modal i define

<script src="js/reports/stimulsoft.reports.js">
<script src="js/reports/stimulsoft.viewer.js">

everytime it shows it works fine.

The case is, if the modal is loaded, and stimulsoft.reports.js was already loaded...i wouldn have to load stimulsoft.reports.js again...or am i wrong?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Viewer and Designer

Post by HighAley »

Hello.

The modal form is shown on the same page.
You don't need to load the same js file again and again.
Could you send us a sample that will allow us to reproduce the issue?

Thank you.
Post Reply