function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ron-LONRon-LON 

Getting embedded Visualforce cols to line up with Page Layout

Hi,

 

I would like to put a bit of Visualforce at the top of the Opportunity page layout. 

 

I have two columns of data and I would like these two columns to line up with the columns where all the of the opportunity fields on the page layout are.

 

This is the code I have now:

 

<table>
<tr><td>
<apex:outputPanel rendered="{! NOT(ISBLANK(opp.Cannot_Autorenew_Reason__c))}" >
<img src="/img/msg_icons/error32.png" /> 
</apex:outputPanel>

</td>
<td width="50%">
<apex:dataList value="{!scoreTextLeft}" var="s" >
{!s}
</apex:DataList> 
</td>
<td width="50%">
<apex:dataList value="{!scoreTextRight}" var="s" >
{!s}
</apex:DataList> 
</td>
</tr>
</table>

 

I like the look of the <apex:dataList> as it bulletpoints each item from the list.

 

I've also tried a PageblockTable.  To make it even more difficult, I'd love for each one of these lists to line up with the side of the column on the standard page layout where the data values are, rather than the side where the field labels are.

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

Try this in a Pageblock table as shown below,

 

Page

<apex:page standardController="Opportunity" extensions="OppController">
<apex:form>

.....
<apex:dataTable value="{!oppList}" var="o">
    <apex:column Headervalue="<your col name>">
       <!--your value as input or output text>
    </apex:column>
..........
    <apex:column Headervalue="<your col name>">
       <!--your value as input or output text>
    </apex:column>

</apex:dataTable>
....

</apex:form>
</apex:page>


Controller:
public class OppController{
   public List<Opportunity> oppList{get;set;}
   public opportunity opp{get;set;}

  public oppController(Apexpages.StandardController controller){
      opp = (Opportunity)controller.getRecord();
  }
 
  public List<Opportunity> getOppList(){
      oppList = [select id,name,<...field to query> from Opprtunity where id =: opp.id];
      return oppList;
  }
}

 

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.