Apart from the variables, which values can be set on the parameter viewer. The viewer supports other kinds of interactivity, which add convenience and functionality when using the report generator. They are sorting, collapsing and detailing.

 

Sorting

Dynamic sorting is an ability, which allows you to change sorting direction in a rendered report. To do it, you should click on the component, which had a set dynamic sorting. Dynamic sorting is carried out in the following ways: Ascending, Descending. Each time when clicking on a component, the direction is reversed.

 

Multilevel sorting in a report is allowed. To do that, you should hold the Ctrl button and step by step click on sorted report components. To reset sorting you can click on any sorted component not holding the Ctrl button.

 

Collapsing

A report with dynamic collapsing is an interactive report, where definite blocks can collapse/expand their content when clicking on block header. Report elements, which can be collapsed/ expanded, they are marked with a special icon with a [-] or [+] sign.

 

Drill-Down

When detailing data, the panel of drill down with tabs of drilled reports will be displayed under the viewer toolbar. There is an ability, which allows you to close not required detailing pages at the moment.

 

The viewer interactivity event

To make dynamic sorting, collapsing and drill-down reports work you don't need any additional settings of the viewer. To make some actions before sorting, collapsing or drilling down a report you should use the onInteraction event, which will be invoked when interactive actions of the viewer are made. There is a definite type of action for each kind of the viewer interactivity.

 

Name

Description

Sorting

The action happens when using the sorting of columns.

DrillDown

The action happens when using the detailing of columns.

Collapsing

The action happens when using the collapsing of report blocks.

Variables

The action happens when using variables on the parameter panel. You can find a detailed description in the Work with Report Variables chapter.

 

viewer.php

 

<?php

$viewer = new \Stimulsoft\Viewer\StiViewer();

$viewer->onInteraction = 'onInteraction';

$viewer->renderHtml();

?>

 

function onInteraction(args) {

switch (args.action) {

case "Sorting":

break;

 

case "DrillDown":

break;

 

case "Collapsing":

break;

}

}

 

 

 

In arguments, corresponding collections of the sortingParameters, collapsingParameters and drillDownParameters parameters are transferred. They contain data in a special format, needed for the current interactive action.

 

viewer.php

 

var sortingParameters = {

ComponentName: "Text10;false",

DataBand: "DataBand1;DESC;CompanyName"

};

 

var collapsingParameters = {

CollapsingStates: {

GroupHeaderBand1: {

keys: [1],

values: [false]

},

ComponentName: "GroupHeaderBand1"

};

 

var drillDownParameters = [

{

ComponentIndex: "1"

DrillDownMode: null

ElementIndex: "6"

PageGuid: "b916d048d3f446dc97c356d4ff47f48f"

PageIndex: "0"

ReportFile: null

}

];

 

 

 

If needed, the values of parameter collection can be corrected, at the same time saving structure and order of transferred values. You can find a detailed description of available argument values in the Viewer Events chapter.