You need to sign in to do that
Don't have an account?
How can I use panelgrid and repeat in a VF page?
I have used paneldgrid to create a table with VF where field values are fetch from the Lead object.
How can I create a custom controller to query the data base and bring field values from the Lead object that will populate the grid cells?
I need to iterate over the Lead object so is it the best way to do this by using a repeat component? (I want to bring the corresponding field values to Status, Name, Phone, and Coments Line 1)
If anyone can help with some code I would really appreciate it!! thanks!!
Here it's the VF code I have so far:
<apex:page StandardController="Lead">
<style>
.colClass{
width:60%;
padding: 5px;
}
.myHeader {
background: #cecece;
font-weight: bold;
}
</style>
<!-- Report Title - Date-->
<apex:panelGrid width="100%" cellpadding="0" cellspacing="0" rules="all">
<apex:outputText value="Title- Date"/>
</apex:panelGrid>
<!-- The table-->
<apex:panelGrid columns="2" width="100%" cellpadding="0" cellspacing="0" rules="all">
<!-- Status column -->
<apex:outputPanel style="padding:5px;" layout="block" styleClass="myHeader">
<apex:outputText value="Status"/>
</apex:outputPanel>
<!-- Name - Phone column-->
<apex:outputPanel style="padding:5px;" layout="block" styleClass="myHeader">
<apex:outputText value="Name - Phone"/>
</apex:outputPanel>
<!-- Status field value -->
<apex:outputPanel style="padding:5px;" layout="block">
<apex:outputText value="{!lead.status}"/>
</apex:outputPanel>
<!-- Name - Phone field value-->
<apex:outputPanel style="padding:5px;" layout="block">
<apex:panelGrid width="100%" cellpadding="0" cellspacing="0" rules="all">
<apex:outputText value="{!lead.name}"/>
<apex:outputText value="{!lead.phone}"/>
</apex:panelGrid>
</apex:outputPanel>
</apex:panelGrid>
<!-- Comments Lines 1-->
<apex:outputText value="Comments Line 1"/>
</apex:page>
Hello,
Please refer the section "Building a custom controller" under the section "custom controlle and controller extension" in the following link which has explained this with example:
http://www.salesforce.com/us/developer/docs/pages/
For iterating through the object record make user of SOQL For Loops. Example:
String s = 'abc';
for (Lead a : [SELECT Id, Name from Lead
where Name LIKE :(s+'%')]) {
// Your code
}
// Create a list of account records from a SOQL query
List<Lead> accs = [SELECT Id, Name FROM Lead WHERE Name = 'Siebel'];
// Loop through the list and update the Name field
for(Lead a : accs){
a.Name = 'Test';
}
// Update the
Hope this helps!