Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
on<Event>. Pass a handler function and it will be invoked with an event object:import React from 'react';
import { StimulsoftViewer } from 'stimulsoft-viewer-react';
export const App: React.FC = () => {
const loaded = (): void => {
console.log('Report loaded');
};
const onExport = (event: any): void => {
console.log(`Export to: ${event.format}`);
};
return (
<StimulsoftViewer
requestUrl="/Viewer/{action}"
action="InitViewer"
height="100vh"
onLoaded={loaded}
onExport={onExport}
/>
);
};onLoaded fires once the report has been rendered and is ready, and onExport fires when the user exports the report — the event object carries details such as the target format. The same pattern works for other viewer events (printing, interaction, e-mail, and more); simply add the corresponding on... prop.ViewerEvent action, registered in the options during initialization:public IActionResult InitViewer()
{
var requestParams = StiReactViewer.GetRequestParams(this);
var options = new StiReactViewerOptions();
options.Actions.GetReport = "GetReport";
options.Actions.ViewerEvent = "ViewerEvent";
return StiReactViewer.ViewerDataResult(requestParams, options);
}
[HttpPost]
public IActionResult ViewerEvent()
{
return StiReactViewer.ViewerEventResult(this);
}StiReactViewer.ViewerEventResult helper processes the incoming event and returns the result the viewer expects, so server-side actions such as export and print work out of the box.