0

I am developing a code for "Use an inline Visualforce page in Record Details Page?". In this example,

InLineController

public class InLineController {
    public Contact cont {set; get; }
    public Id accRecId;
    public Account accRec {set; get; }

    public InLineController(ApexPages.StandardController controller){
        if(ApexPages.currentPage().getParameters().get('id') != null){
            Id id = ApexPages.currentPage().getParameters().get('id');
            accRecId = [select id,accountid from contact where id = :id].accountid;
            if(accRecId != null){
                accRec = [select id,name,accountnumber,annualrevenue from account where id =:accRecId];
            }
        }
    }
}

InLineControllerVFPage

<apex:page standardController="Contact" extensions="InLineController">
    <apex:form>
        <apex:pageBlock title="My Inline Visualforce page">
            <b>Account Name : </b><apex:outputField value="{!accRec.name}" /> <br/>
            <b>Account Number : </b><apex:outputField value="{!accRec.accountNumber}" /> <br/>
            <b>Annual Revenue : </b><apex:outputField value="{!accRec.annualrevenue}"/><br/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

The only problem which I face is that I want "My Inline Visualforce page" in a single line. How we can get that ?

enter image description here

3 Answers 3

0

@Admano - As per suggestion, we can used it in the <apex:form style="white-space: nowrap;"> like below. It works fine.

<apex:page standardController="contact" extensions="InLineController">
    <apex:form style="white-space: nowrap;">
       <apex:pageBlock title="My Inline Visualforce page">
        <b>Account Name : </b> <apex:outputField value="{!accRec.name}"/><br/>
        <b>Account Number: </b> <apex:outputField value="{!accRec.accountnumber}"/><br/>
         <b>Annual Revenue : </b><apex:outputField value="{!accRec.annualrevenue}"/>
       </apex:pageBlock>
    </apex:form>
</apex:page>

enter image description here

4
  • I'm Adamo :D Remember that :D
    – Adamo
    Commented Jun 12, 2017 at 18:56
  • Thanx, Corrected your name.
    – user45930
    Commented Jun 12, 2017 at 18:57
  • Great, simple solution works ! Commented Jun 12, 2017 at 18:58
  • No problem :D I joked
    – Adamo
    Commented Jun 12, 2017 at 18:58
1

You can use:

<apex:sectionHeader title="" subTitle=""/>

instead of

<apex:pageBlock title="My Inline Visualforce page">

Your example:

<apex:page standardController="Contact" extensions="InLineController">
    <apex:form>
      <apex:sectionHeader title="My Inline Visualforce page" subTitle=""/>`
        <apex:pageBlock>
            <b>Account Name : </b><apex:outputField value="{!accRec.name}" /> <br/>
            <b>Account Number : </b><apex:outputField value="{!accRec.accountNumber}" /> <br/>
            <b>Annual Revenue : </b><apex:outputField value="{!accRec.annualrevenue}"/><br/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

--edit

Did you try add css style:

<style type="text/css">
.bPageBlock .pbBody { white-space: nowrap; }
</style>
4
  • No, I dont want to use it as SectionHeader, I want to use it as pageBlock only. Commented Jun 12, 2017 at 18:45
  • Understood. I add a new proposition
    – Adamo
    Commented Jun 12, 2017 at 18:47
  • Unsupported attribute style in <apex:pageBlock> in InLineControllerVFPage at line 3 column 88, we cant use style. Commented Jun 12, 2017 at 18:49
  • Please check my last edit.
    – Adamo
    Commented Jun 12, 2017 at 18:54
1

The page section needs to be one column edit the page layout to set it as 1 column.

1
  • Great, simple solution works ! Commented Jun 12, 2017 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .