Page 1 of 1

PostInteraction Implementation and override

Posted: Tue Mar 08, 2022 3:04 pm
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?

Re: PostInteraction Implementation and override

Posted: Wed Mar 09, 2022 10:51 am
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.