The viewer supports the events, which give an ability to make necessary operations before definite actions both on the JavaScript client-side and on the PHP server-side. To make events work on the client-side, you don't need any additional settings. To make events work on the server-side, you should add a special event handler to the page. You can find a detailed description of connection and setting the PHP event handler in the PHP Events Handler chapter.

 

The viewer supports the following events:

onBeginProcessData
onEndProcessData
onPrepareVariables
onPrintReport
onBeginExportReport
onEndExportReport
onInteraction
onEmailReport
onDesignReport

 

 

 

onBeginProcessData

The event is invoked before data request, which needed to render a report. The list of arguments of the event is in the Engine Events chapter. You can find a detailed description and samples of using in the Connecting Data Files and Connecting SQL Data Adapters chapters.

 

 

onEndProcessData

The event is invoked after loading data before rendering a report. The list of the event arguments are in the Engine Events chapter. You can find a detailed description and samples of using in the Connecting Data Files and Connecting SQL Data Adapters chapters.

 

 

onPrepareVariables

The event is invoked before rendering a report after preparing report variables. The list of the event arguments is in the Engine Events chapter. You can find a detailed description and samples of using in the Work with Report Variables chapter.

 

onPrintReport

The event is invoked before printing a report. In the table below, you can find the list of the event handler arguments on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "PrintReport" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

report

Current report object.

printAction

The type of report print. It can take the following values:

StiPrintAction::PrintPdf - Print to PDF format;
StiPrintAction::PrintWithoutPreview - Print to HTML format, directly to the printer. The system print dialog will be displayed;
StiPrintAction::PrintWithPreview - Print to HTML format with preview in a pop-up window.

fileName

Report file's name for saving.

preventDefault

This flag gives an ability to stop further event processing by the viewer. The false value is set by default.

 

 

In the table below you can find the list of the event handler arguments on the PHP server-side.

 

Name

Description

sender

The identifier of the component, which initiated this event can take the following values:

StiComponentType::Viewer
StiComponentType::Designer

printAction

Report print type. It can take the following values:

StiPrintAction::PrintPdf - Print to PDF format;
StiPrintAction::PrintWithoutPreview - Print to HTML format directly to the printer. System print dialog will be displayed;
StiPrintAction::PrintWithPreview - Print to HTML format with preview in a pop-up window.

fileName

Report file name for saving.

 

 

You can find a detailed description and samples of using in the Printing Report chapters.

 

 

onBeginExportReport

The event is invoked before exporting a report after the dialog of export settings. In the table below, you can see the list of the event handler argument on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "BeginExportReport" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

action

The action, which initiated export event can take the following values:

Stimulsoft.Viewer.StiExportAction.ExportReport
Stimulsoft.Viewer.StiExportAction.SendEmail

report

Current report object.

format

Selected report export format. It can take the following values:

Stimulsoft.Report.StiExportFormat.Document
Stimulsoft.Report.StiExportFormat.Pdf
Stimulsoft.Report.StiExportFormat.Xps
Stimulsoft.Report.StiExportFormat.Ppt2007
Stimulsoft.Report.StiExportFormat.Html
Stimulsoft.Report.StiExportFormat.Html5
Stimulsoft.Report.StiExportFormat.Text
Stimulsoft.Report.StiExportFormat.Word2007
Stimulsoft.Report.StiExportFormat.Excel2007
Stimulsoft.Report.StiExportFormat.Odt
Stimulsoft.Report.StiExportFormat.Ods
Stimulsoft.Report.StiExportFormat.Csv
Stimulsoft.Report.StiExportFormat.ImageSvg

formatName

Name of a selected report export format corresponds to the name of the constants in format list.

settings

Settings of a selected export format. List of available properties will depend on a selected export type.

fileName

Report file name for saving after export completed.

openAfterExport

The flag indicates that a report will be exported in a new browser tab (the true value) or after export completed file saving will be invoked (the false value).

preventDefault

This flag gives an ability to stop furher event processing by the viewer. The false value is set by default.

 

 

In the table below, you can see the list of event handler argument on the PHP server-side.

 

Name

Description

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

action

The action, which invoked export event can take the following values:

StiExportAction::ExportReport
StiExportAction::SendEmail

format

Selected report export format. It can take the following values:

StiExportFormat::Document
StiExportFormat::Pdf
StiExportFormat::Xps
StiExportFormat::Ppt2007
StiExportFormat::Html
StiExportFormat::Html5
StiExportFormat::Text
StiExportFormat::Word2007
StiExportFormat::Excel2007
StiExportFormat::Odt
StiExportFormat::Ods
StiExportFormat::Csv
StiExportFormat::ImageSvg

formatName

Name of a selected report export corresponds to the name of constants in the format list.

fileName

Report file name for saving after export completed.

settings

Settings of a selected export format. List of available properties will depend on a selected export type.

 

 

You can find a detailed description and samples of using in the Report Export chapter.

 

 

onEndExportReport

The event is invoked after exporting a report till its saving as a file. In the table below, you can see the list of the event handler argument on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "EndExportReport" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

report

Current report object.

format

Selected report export format. It can take the following values:

Stimulsoft.Report.StiExportFormat.Document
Stimulsoft.Report.StiExportFormat.Pdf
Stimulsoft.Report.StiExportFormat.Xps
Stimulsoft.Report.StiExportFormat.Ppt2007
Stimulsoft.Report.StiExportFormat.Html
Stimulsoft.Report.StiExportFormat.Html5
Stimulsoft.Report.StiExportFormat.Text
Stimulsoft.Report.StiExportFormat.Word2007
Stimulsoft.Report.StiExportFormat.Excel2007
Stimulsoft.Report.StiExportFormat.Odt
Stimulsoft.Report.StiExportFormat.Ods
Stimulsoft.Report.StiExportFormat.Csv
Stimulsoft.Report.StiExportFormat.ImageSvg

formatName

Name of a selected report export corresponds to the name of constants in the format list.

data

Byte data of an exported report, prepared for saving to a file.

fileName

Report file name for saving after export completed.

openAfterExport

The flag indicates that a report will be exported in a new browser tab (the true value) or after export completed file saving will be invoked (the false value)

preventDefault

This flag gives an ability to stop further event processing by the viewer. The false value is set by default.

 

 

In the table below, you can see the list of the event handler argument on the PHP server-side.

 

Name

Description

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

format

Selected report export format. It can take the following values:

StiExportFormat::Document
StiExportFormat::Pdf
StiExportFormat::Xps
StiExportFormat::Ppt2007
StiExportFormat::Html
StiExportFormat::Html5
StiExportFormat::Text
StiExportFormat::Word2007
StiExportFormat::Excel2007
StiExportFormat::Odt
StiExportFormat::Ods
StiExportFormat::Csv
StiExportFormat::ImageSvg

formatName

Name of a selected report export corresponds to the name of constants in the format list.

data

Byte data of an exported report, prepared for saving to a file.

fileName

Report file name for saving after export completed.

fileExtension

Report file extension for saving after the export completed corresponds to the type of a selected format.

 

 

You can find a detailed description and samples of using in the Report Export chapter.

 

 

onInteraction

The event is invoked while interactive action of the viewer (dynamic sorting, collapsing, drill-down, applying of parameters) until processing values by the report generator. In the table below, you can see the list of the event handler argument on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "Interaction" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

report

Current report object.

action

The identifier of the current interactive action can take the following values:

Sorting - This action happens when using sorting columns;
DrillDown - This action happens when using sorting columns;
Collapsing - This action happens when using of collapsing report blocks.

variables

The collection of report variables and their values, set in the parameter panel.

sortingParameters

The collection of parameters, needed for dynamic report sorting.

collapsingParameters

The collection of parameters needed for dynamic report elements collapsing.

drillDownParameters

The collection of parameters, needed for report drilldown.

 

 

You can find a detailed description and samples of using in the Dynamic Sorting, Collapsing, and Drill-Down chapter.

 

 

onEmailReport

The event is invoked after exporting a report before sending it by Email. In the table below, you can see the list of the event handler argument on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "EmailReport" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

report

Current report object.

format

Selected report export format. It can take the following values:

Stimulsoft.Report.StiExportFormat.Document
Stimulsoft.Report.StiExportFormat.Pdf
Stimulsoft.Report.StiExportFormat.Xps
Stimulsoft.Report.StiExportFormat.Ppt2007
Stimulsoft.Report.StiExportFormat.Html
Stimulsoft.Report.StiExportFormat.Html5
Stimulsoft.Report.StiExportFormat.Text
Stimulsoft.Report.StiExportFormat.Word2007
Stimulsoft.Report.StiExportFormat.Excel2007
Stimulsoft.Report.StiExportFormat.Odt
Stimulsoft.Report.StiExportFormat.Ods
Stimulsoft.Report.StiExportFormat.Csv
Stimulsoft.Report.StiExportFormat.ImageSvg

formatName

Name of a selected report export corresponds to the name of constants in the list of formats.

data

Byte data of an exported report, prepared for sending by Email.

fileName

Report file name for sending by Email.

settings

The object, which contains parameters, filled in the viewer dialog of sending a report by Email. The description of all parameters is in a separate table below. All the parameters must be filled (they can be checked and filled on the PHP server-side).

 

 

In the table below you can see the list of parameters of sending Email on the JavaScript client-side.

 

Name

Description

email

The Email address, which will receive an exported report.

subject

Email theme.

message

Email text.

 

 

In the table below, you can see the list of the event handler argument on the PHP server-side.

 

Name

Description

sender

The identifier of the component, which initiated this event can take the following values:

Viewer
Designer

format

Selected report export format. It can take the following values:

StiExportFormat::Document
StiExportFormat::Pdf
StiExportFormat::Xps
StiExportFormat::Ppt2007
StiExportFormat::Html
StiExportFormat::Html5
StiExportFormat::Text
StiExportFormat::Word2007
StiExportFormat::Excel2007
StiExportFormat::Odt
StiExportFormat::Ods
StiExportFormat::Csv
StiExportFormat::ImageSvg

formatName

Name of a selected report export corresponds to the name of constants in the list of formats.

data

Byte data of an exported report, prepared for sending by Email.

fileName

Report file name for sending by Email.

settings

The object, which contains parameters, filled in the viewer dialog of sending a report by Email. The description of all parameters is in a separate table below.

 

 

In the table below you can see the list of parameters of sending Email on the PHP server-side:

 

Name

Description

from

Email address of a Email sender.

name

Name and surname of a Email sender.

to

The email address which will receive an exported report is transferred from the viewer dialog window.

subject

Email theme is transferred from the viewer dialog window.

message

Email text is transferred from the viewer dialog window.

attachmentName

Report name in attachment. Report file name is used by default.

charset

The coding, used for Email text. The "UTF-8" is used by default.

host

The SMPT server is mandatory to fill in.

port

The SMPT port server. The 465 is used by default.

secure

The type of connection encryption with mail server, the "ssl" can be used (by default) or "tls" encryption.  

login

The log in of connection to the mail server is mandatory to fill in.

password

Password for connection to the mail server is mandatory to fill in.

cc

The CC array (Carbon Copy) addresses of secondary Email recipients.

bcc

The BCC array (Blind Carbon Copy) of addresses of hidden Email recipients.

 

 

You can find a detailed description and samples of using in the Sending Report by Email chapter.

 

 

onDesignReport

The event is invoked when clicking the Design button in the viewer panel. In the table below you can see the list of the event handler argument on the JavaScript client-side.

 

Name

Description

event

The identifier of the current event has the "DesignReport" value.

sender

The identifier of the component, which initiated this event can take the following values:

Viewer

report

Current report object.

fileName

Report file name for sending and loading to the designer.

 

 

You can find a detailed description and samples of using in the Calling Designer from the Viewer chapter.