Hitachi Vantara Pentaho Community Wiki
Child pages
  • CDF Portlets

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

2) After unpacking, I have done some modifications to IFramePortlet

a) iframe.jsp -

The part of code added is:

Code Block
javascript
javascript
<script type="text/javascript">

function getElement(aID)
{
return (document.getElementById) ?
document.getElementById(aID) : document.all[aID];
}

function getIFrameDocument(aID){
var rv = null;
var frame=getElement(aID);
// if contentDocument exists, W3C compliant (e.g. Mozilla)

if (frame.contentDocument)
rv = frame.contentDocument;
else // bad IE

rv = document.frames[aID].document;
return rv;
}

function adjustMyFrameHeight()
{
var frame = getElement("myFrame");
var frameDoc = getIFrameDocument("myFrame");
frame.height = frameDoc.body.offsetHeight;
}
</script>
  • I have modified the "<iframe>" part by adding id and onloada function. Like this:
Code Block
javascript
javascript
<iframe id="myFrame" src="<%= request.getAttribute("iframeurl") %>" width="<%= request.getAttribute("iframewidth") %>" onload="adjustMyFrameHeight()" frameborder="0">
Your browser does not support iframes
</iframe>
  • I have also removed the part that enables opening the iframe in a new window, I don't need it

b) iFramePortlet.java

  • I have modified the defaultURL and set:

private static final String defaultURL = "http://localhost:8080/pentaho/Dashboards"; (you can replace localhost with another URL if needed)

  • I have also done some modifications to enable setting height in percentage, but it is not needed for this solution to work

c) portlet.xml - I have modified this file to disable Porlet EDIT mode because I don't need it to be editable. I have just removed the line:

...