New to Telerik ReportingStart a free 30-day trial

React Report Viewer Methods

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

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

The example above refreshes the report viewer.

The following table lists the available methods:

MethodDescription
refreshReport()Reloads/refreshes the current report.
Returns : the current ReportViewer object.
getReportSource(): anyGets 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.
getReportParameters(): anyReturns an immutable array of name-value objects representing the current evaluated report parameters.
Returns : array containing the name and the value of each report parameter.
getViewMode(): stringGets 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(): anyGets 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(): stringGets 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(): numberGets the total page count of viewer’s currently displayed report.
Returns : number.
currentPage(): numberGets 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(): JSONGets 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:
KeyDefault ValueDescription
CONFIRM_KEY13 ('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_KEY77 ('m')Key for moving the focus to the menu area, if visible.
CONTENT_AREA_KEY67 ('c')Key for moving the focus to the report content area, if visible.
PARAMETERS_AREA_KEY80 ('p')Key for moving the focus to the parameters area, if visible.
DOCUMENT_MAP_AREA_KEY68 ('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.
Not finding the help you need?
Contact Support