Jump to content

BIRT Developer Center Download


Photo

JSAPI dashboard in edit mode

jsapi dashboard

  • Please log in to reply
4 replies to this topic

#1 turbo_di

turbo_di

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 March 2017 - 08:40 PM

Hi

 

I have a dashboard, which is integrated in my single page application with JSAPI, and I would like to make it editable (to give users ability to construct adhoc reports based on provided data objects). I didn't find any appropriate methods in actuate.Dashboard class.

 

Is it possible with JSAPI or should I use iframe for this?

Thanks in advance!



#2 Clement Wong

Clement Wong

    Senior Member

  • BIRT Experts
  • 1105 posts

Posted 14 March 2017 - 03:09 PM

Yes, with JSAPI, you can set dashboard.setIsDesigner(true); to edit mode.  Otherwise, set dashboard.setIsDesigner(false); to read-only.

<script type="text/javascript" src="http://ihub:8700/iportal/jsapi"></script>
...

<body onload="acload()">
   <div id="dashboardContainer">
     
     <script defer="defer" type="text/javascript" language="JavaScript">
         var dashboard;
         function acload() {
            actuate.load("dashboard");
            var reqOps = new actuate.RequestOptions( );
            reqOps.setRepositoryType(actuate.RequestOptions.REPOSITORY_ENCYCLOPEDIA);
            reqOps.setVolume( "Default Volume" );
            actuate.initialize("http://ihub:8700/iportal/",reqOps,null,null, afterInit );
         }
 
         function afterInit(){
            var containerID = "dashboardContainer";
            dashboard = new actuate.Dashboard(containerID);
            dashboard.setIsDesigner(true);
            dashboard.setDashboardName("/dashboards/foo.dashboard");
            dashboard.submit();
         }
          
   </script>

...
	 
	 
	</body>
</html>

Clement Wong
Principal Analytics Architect

OpenText Corporation
http://www.actuate.com | http://www.opentext.com


#3 turbo_di

turbo_di

    Member

  • Members
  • PipPip
  • 15 posts

Posted 15 March 2017 - 08:36 PM

Cool, that works!

 

However I got the following in browser console:

Access to Font at 'http://127.0.0.1:8700/iportal/dashboard/fonts/yggdrasil/yggdrasil.ttf' 
from origin 'http://localhost:1841' has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:1841' is therefore not allowed access.

Is there a way to configure CORS for ihub resources?

 

Thank you very much



#4 Clement Wong

Clement Wong

    Senior Member

  • BIRT Experts
  • 1105 posts

Posted 19 March 2017 - 11:27 PM

You can change the setting in WEB-INF/web.xml (of Information Console):

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

A restart is needed.


Clement Wong
Principal Analytics Architect

OpenText Corporation
http://www.actuate.com | http://www.opentext.com


#5 delee

delee

    Newbie

  • Members
  • Pip
  • 5 posts

Posted Yesterday, 09:27 AM

What would be the JSAPI to view a data object, using the Data Analyzer? 







Also tagged with one or more of these keywords: jsapi, dashboard