1

We have a related list which is a VF page and when we don't have any records, we are getting a white space in the related list section. Also, is there a way to dynamically set the section size of the related list in page layout.

  • 1
    It may help to provide a bit more body to the question, as in for instance share some of your VF code or screenshots. – Samuel De Rycke Jul 30 '13 at 15:10
  • On the relatedList component, use attribute pageSize. From the doc: pageSize Integer The number of records to display by default in the related list. If not specified, this value defaults to 5. – cropredy Jul 30 '13 at 23:08
1

You can not dynamically set the height or width of a visualforce page that is included in the standard page layout. You can set the height to a fixed height. There are 3 alternatives though that I can see and which I will describe briefly.

Option 1:You can override the standard page layout with something like this:

<apex:page standarController="MyObject" extension="ControllerFromYourVFPageYouAlreadyCreated">
    <apex:detail subject="{!MyObject.Id}" relatedList="false" title="false"/> 

    ....put the visualforce stuff from your already created VFPage here....

    <apex:relatedList list="RelatedObject1">
    <apex:relatedList list="RelatedObject2">
    ....
    <apex:relatedList list="RelatedObjectn">
</apex:page>

You would then not have the links on top of your page that go to the related lists though. Your controller will need some minor tweaks probably.

Option 2: Much the same as option 1:

<apex:page standarController="MyObject" extension="ControllerFromYourVFPageYouAlreadyCreated">
    <apex:detail subject="{!MyObject.Id}" relatedList="true" title="false"/> 

    ....put the visualforce stuff from your already created VFPage here....
</apex:page>

The stuff from you VF page is now at the bottom of the page, but you would have your links to the related lists on the top of your page back.

Option 3:

basically do the same stuff but instead of putting the VF directly in there you include it in an iframe. Then you use javascript to dynamicallyalter the size of the iframe. You need javascript on both pages. This is a hassle and I definately wouldn't go for this option, but it is an option...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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