Page 1 of 1

Dashboard with iFrames

Posted: Mon Aug 21, 2017 1:27 pm
by devinst
I would like to create a dashboard of charts. Each chart is a separated ProfoundUI program. Each chart program uses the currently signed on user to filter the data being displayed.
I would like to use this design so that I can easily build different dashboards using the same chart programs.
My question is, since the chart programs will need to run as anonymous programs due to being in an iFrame, how would I retrieve the user that is logged into the main dashboard program in Atrium so that I can filter the data?
Thanks.!!

Re: Dashboard with iFrames

Posted: Tue Aug 22, 2017 10:23 am
by matt.denninghoff
If you are loading a URL in an iframe, and then you're using JavaScript to filter for a user, then you could use the Atrium getUser API function:
http://www.profoundlogic.com/docs/pages ... d=12648660

As long as the parent window has the same origin (protocol, domain name, and port number), then the iframe can access the parent's javascript functions. So code running in the iframe would be used to access the parent iframe's getUser function.

For example, this code running in my RPG Rich Display program in an Atrium tab (an iframe) will print the user logged into Atrium in the parent window:

Code: Select all

if (window.parent != window && window.parent.Atrium ){
  //This page is loaded in an iframe in Atrium.
  console.log("Atrium User:",window.parent.Atrium.api.getUser() );
}
(The print output goes to the browser's JavaScript console.)