Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is there a way to automatically resize the inline visualforce components on standard page layout based on the content of the visualforce page.

Update

Has anyone used this app or link to implement automatically resize inline visualforce component

App is not working for orgs with custom domain.Someone please help me.

share|improve this question
5  
Take a look at the AppExchange reviews for the app, it seems to be hitting some issues. The link you gave reveals likely the reason why, both will be doing this by poking into the page definition Salesforce creates, which is bad practice, since in doing so one needs to make some assumptions in their code that will likely break in the future as this is not supported, I've +1 the answer below its the reality sadly and the safest direction. –  Andrew Fawcett Jan 23 at 16:29
    
@AndrewFawcett App is not working for one of my org with custom domain else it working fine in other orgs without custom domain. –  sf.dev Apr 9 at 19:57
add comment

2 Answers

I don't believe there is, from what I recall I've always had to set a static height. Unfortunately the standard page layout and the Visualforce get served up from different domains, so you can't do any cross site scripting to access the Visualforce page's parent and resize the iframe.

The alternative is using a custom VF page to replace the Standard Page Layout (using apex:detail) and appending your Visualforce customizations to the bottom.

share|improve this answer
add comment

I made this work with jquery - it is not very portable, but does seem to work...

I have a case detail page with some inline VF components. I also have a VF page that overrides my Case Detail page but displays the standard case detail via an apex:detail tag. That way, I can change the size of the VF components via JS on the case detail override page. As I say, it ain't pretty but it does work...

<apex:page standardController="Case" extensions="CaseTaskExtension">

<apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>
  <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" />
  <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" />

<script type="text/javascript">
       var j$ = jQuery.noConflict();


       j$(document).ready(function(){

         var commentsize =  '{!ccsize}'; //param from controller
          if (commentsize > 0 && commentsize < 200) {
          commentsize = 200;
          }

  //Replace with Id of VF Page that is used for inline component

         j$('#066i0000000GTnI').css('height', commentsize);

        });
 </script>  

<apex:detail subject="{!case.Id}" showChatter="true" relatedList="true" relatedListHover="true">

</apex:detail>
</apex:page>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.