PostInteraction Implementation and override

Stimulsoft Reports.JS discussion
Post Reply
CristianDust
Posts: 1
Joined: Tue Mar 08, 2022 3:00 pm

PostInteraction Implementation and override

Post by CristianDust »

Hi, we have this bit of code

viewer used type is viewer: Stimulsoft.Viewer.StiViewer,

viewer.jsObject.postInteractionOld = viewer.jsObject.postInteraction;
viewer.jsObject.postInteraction = (params: PostInterraction) => {
if (params.action == 'InitVars') {
//
}

if (params.action == 'Variables' && AllowApiReportCallback.includes(viewer.report.reportName)) {
///
}
viewer.jsObject.postInteractionOld(params);
};

Problem is it keeps complaining Property 'postInteractionOld' does not exist on type 'StiJsViewer'.ts(2339) Any ideas?
Lech Kulikowski
Posts: 6240
Joined: Tue Mar 20, 2018 5:34 am

Re: PostInteraction Implementation and override

Post by Lech Kulikowski »

Hello,

You can use the following code:

Code: Select all

//viewer.jsObject.postInteractionOld = viewer.jsObject.postInteraction;
const postInteractionOld = viewer.jsObject.postInteraction.bind(viewer.jsObject);
viewer.jsObject.postInteraction = (params: PostInterraction) => {
if (params.action == 'InitVars') {
//
}

if (params.action == 'Variables' && AllowApiReportCallback.includes(viewer.report.reportName)) {
///
}
postInteractionOld(params);
};
If it doesn't help you, please send us a sample project.

Thank you.
Post Reply