There is the preview of an edited report mode. To use it, you should go to the corresponding tab in the designer window. Report template will be rendered and displayed in the embedded viewer.

 

 

Preview event

You can make some necessary actions, for example, connect data for a report before view a report. To do it, you should use the onPreviewReport event, which will be invoked before viewing a report. In arguments of the event, the report intended for viewing will be transferred.

 

designer.php

 

<?php

$designer = new \Stimulsoft\Designer\StiDesigner();

$designer->onPreviewReport = 'onPreviewReport';

$designer->renderHtml();

?>

 

function onPreviewReport(args) {

var dataSet = new Stimulsoft.System.Data.DataSet("SimpleDataSet");

dataSet.readJsonFile("Data/Demo.json");

 

args.report.regData(dataSet.dataSetName, "", dataSet);

}

 

 

 

Additional features

The report preview in the designer is a full-featured interactive viewer, which can print and export a report and supports the work with report parameters. All available interactive actions are supported, such as dynamic sorting, drill-down, collapsing. To use the specified features you don't need any additional settings of the report designer.

 

If needed, you can use any events of the viewer. To do it you should refer to the embedded StiViewer object in the report designer and subscribe to the event you need. This option is only available when using JavaScript code, for example:

 

designer.php

 

designer.viewer.onBeginExportReport = function (event) {

switch (event.format) {

case Stimulsoft.Report.StiExportFormat.Html:

event.settings.zoom = 2; // Set zoom to 200%

break;

 }

}

 

 

Information

 

Refer to the embedded viewer is possible only after display of the designer component on the page, i.e. after the designer.renderHtml() method invoked or the viewer object will not be created.

 

 

 

You can find the list of available events of the embedded viewer and the description of using variants in the Viewer Events chapter.