Dashboard with iFrames

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
devinst
Profound User
Posts: 80
Joined: Mon Apr 20, 2009 11:26 am
First Name: Devin
Last Name: St. Germain
Company Name: Dupre Logistics, LLC
Phone: 337.314.2259
Address 1: 201 Energy Pkwy. Ste. 500
City: Lafayette
State / Province: Louisiana
Zip / Postal Code: 70508
Country: United States
Contact:

Dashboard with iFrames

Post 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.!!
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: Dashboard with iFrames

Post 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.)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests