New to Telerik Reporting? Download free 30-day trial

Methods

Each method can be called using a reference to the report viewer component.

let viewer;
ReactDOM.render(
    <div>
      <TelerikReportViewer
      ...
     />
      <button id="refresh-button" onClick={ () => viewer.refreshReport() }>Refresh</button>
    </div>,
  document.getElementById('root')
);

The example above refreshes the report viewer.

The following table lists the available methods:

Method Description
refreshReport() Reloads/refreshes the current report.
Returns : the current ReportViewer object.
getReportSource(): any Gets the current ReportSource - report and parameters.
Returns : object with properties:
  • report: string
  • parameters: JSON
setReportSource(rs: JSON) Sets the report source - report and parameters. Automatically reloads the report (if any) into the view.
Parameters : rs; rs is an object with the following properties:
  • report: string
  • parameters: JSON
Returns : the current ReportViewer object.
getViewMode(): string Gets the current view mode.
Returns : string.
setViewMode(vm: string) Sets the view mode and automatically reloads the current report (if any) into the new view.
Parameters : vm: string
Returns : the current ReportViewer object.
getScale(): any Gets the viewer’s scale factor and scale mode.
Returns : object with properties:
  • scale: number
  • scaleMode: string
setScale(scale: any) Sets the scale factor and scale mode.
Parameters : scale; scale is an object with the following properties:
  • scale: number
  • scaleMode: string
Returns : the current ReportViewer object.
getPageMode(): string Gets the viewer’s page mode.
Returns : string.
setPageMode(psm: string) Sets the page mode and automatically reloads the current report (if any) into the new view.
Parameters : psm: string.
Returns : the current ReportViewer object.
clearReportSource() Clears the current reportSource from the viewer internal state and from its persisted session in the browser. Called in order to force the viewer to respect the newly set reportSource on the next postback.
pageCount(): number Gets the total page count of viewer’s currently displayed report.
Returns : number.
currentPage(): number Gets the viewer’s current page that is displayed.
Returns : number.
setAuthenticationToken(token: string) Sets the authentication token.
Parameters : token: string
Returns : the current ReportViewer object.
getAccessibilityKeyMap(): JSON Gets the shortcut keys used when the report viewer is in accessible mode (has its enableAccessibility set to true. The keys in the map are listed below:
Key Default Value Description
CONFIRM_KEY 13 ('enter') Key for triggering the actions in the report content and previewing the report from the Preview button in parameters area, if available.
MENU_AREA_KEY 77 ('m') Key for moving the focus to the menu area, if visible.
CONTENT_AREA_KEY 67 ('c') Key for moving the focus to the report content area, if visible.
PARAMETERS_AREA_KEY 80 ('p') Key for moving the focus to the parameters area, if visible.
DOCUMENT_MAP_AREA_KEY 68 ('d') Key for moving the focus to the document map area, if visible.
setAccessibilityKeyMap(keyMap: JSON) Sets the shortcut keys used when the report viewer is in accessible mode. It is recommended to set the new key map when the report rendering is complete, because the accessibility routines require the report viewer template to be loaded.
Parameters : keyMap: JSON
dispose() Stops sending keep alive requests to the server, if keep client alive was enabled.
In this article