Jump to content

Recommended Posts

Posted

Hi Magnus,

I'm trying to redirect controle from within a mod to another page, using the API function, like this:

- using 'SpotfireDocument.setActivePage(2)', how do I implement this

Regards,

Anton.

Posted

Hi Anton,

An instance of the SpotfireDocument is fetched via the Mod API. Adding this short snippet of script into your mod present on all your pages will turn the analys into a carousel, automatically switching to next page every 3 seconds.

Spotfire.initialize(async (mod) => {

setTimeout(() => moveToNextPage(mod.document), 3000);

});

 

async function moveToNextPage(doc)

{

let activePageIndex = (await doc.activePage()).index;

let pageCount = (await doc.pages()).length;

if (activePageIndex + 1 == pageCount)

{

doc.setActivePage(0);

}

else

{

doc.setActivePage(activePageIndex + 1);

}

}

Regards

Erik

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...