Example T1034344
Visible to All Users

Reporting for Angular - Handle the ParametersInitialized event

The example below demonstrates how to handle the ParametersInitialized event to do the following:

  1. Initialize values of a visible and invisible parameter before the viewer loads the document.
  2. Change a parameter value in the panel's editor when a user assigns a value to another parameter.

How to Run the Example

Download the project and do the following:

  1. Update NuGet packages.
  2. Build and run the project.
  3. Navigate to the page that contains the document viewer.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

ReportingWebApp/ClientApp/src/app/reportviewer/report-viewer.html
HTML
<dx-report-viewer [reportUrl]="reportUrl" height="800px"> <dxrv-request-options [invokeAction]="invokeAction" [host]="hostUrl"></dxrv-request-options> <dxrv-callbacks (ParametersInitialized)="OnParametersInitialized($event)"></dxrv-callbacks> </dx-report-viewer>
ReportingWebApp/ClientApp/src/app/reportviewer/report-viewer.ts
TypeScript
import { Component, Inject, ViewEncapsulation, ViewChild } from '@angular/core'; import { DxReportViewerComponent } from 'devexpress-reporting-angular'; @Component({ selector: 'report-viewer', encapsulation: ViewEncapsulation.None, templateUrl: './report-viewer.html', styleUrls: [ "../../../node_modules/devextreme/dist/css/dx.common.css", "../../../node_modules/devextreme/dist/css/dx.light.css", "../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.common.css", "../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.light.css", "../../../node_modules/devexpress-reporting/dist/css/dx-webdocumentviewer.css" ] }) export class ReportViewerComponent { @ViewChild(DxReportViewerComponent, { static: false }) viewer!: DxReportViewerComponent; reportUrl: string = "XtraReport1"; invokeAction: string = '/DXXRDV'; OnParametersInitialized(event: any) { // Specify an invisible integer parameter's value on viewer initialization. var invisibleIntParamValue = 42; var intParam = event.args.ActualParametersInfo.filter( (x: any) => x.parameterDescriptor.name == "intParam")[0]; intParam.value = invisibleIntParamValue; // Specify a visible Boolean parameter's value on viewer initialization. var visibleBooleanParamValue = true; var booleanParam = event.args.ActualParametersInfo.filter( (x: any) => x.parameterDescriptor.name == "booleanParam")[0]; booleanParam.value = visibleBooleanParamValue; // Update a string parameter value when a user changes the Boolean parameter value. var strParam = event.args.ActualParametersInfo.filter( (x: any) => x.parameterDescriptor.name == "strParam")[0]; booleanParam && booleanParam.events.on('propertyChanged', (args: any) => { if (args.propertyName === 'value') { strParam.value = args.newVal.toString(); } }); intParam & booleanParam & strParam && event.args.Submit(); } constructor(@Inject('BASE_URL') public hostUrl: string) { } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.