You need to sign in to do that
Don't have an account?
Satya413
Display Summary Table in VF Page using apex:repeat
Hi,
I am trying to display a summary table using apex:repeat. However, I am not getting the query right. Any help is appreciated. Below is my code.
Object: Time_Table__c
Fields: Class__c --- lookup
Time__c --- lookup
Day__c --- picklist
faculty_name__c --- lookup
VF Page:
<apex:page controller="facultydetails_con" sidebar="false" >
<apex:form >
<center>
<br></br><br></br>
<b>Select Faculty </b>
<apex:inputfield value="{!faculty.Faculty_Name__c}"/><br></br><br></br>
<apex:commandButton value="Submit" action="{!submit}"/>
<apex:pageBlock >
<apex:pageblockSection >
<apex:repeat value="{!fd}" var="item">
<apex:outputText value="{!item.Class__c}" />
</apex:repeat>
</apex:pageblockSection>
</apex:pageBlock>
</center>
</apex:form>
</apex:page>
Controller:
public class facultydetails_con {
public time_table__c faculty {get; set;}
public list<time_table__c> fd {get; set;}
public facultydetails_con()
{
list<time_table__c> fd = new list<time_table__c>();
}
public pagereference submit()
{
fd = [select class__c, day__c, faculty_name__c from time_table__c where faculty_name__c = :faculty.faculty_name__c];
return null;
}
}
Thank you,
Satya
I am trying to display a summary table using apex:repeat. However, I am not getting the query right. Any help is appreciated. Below is my code.
Object: Time_Table__c
Fields: Class__c --- lookup
Time__c --- lookup
Day__c --- picklist
faculty_name__c --- lookup
VF Page:
<apex:page controller="facultydetails_con" sidebar="false" >
<apex:form >
<center>
<br></br><br></br>
<b>Select Faculty </b>
<apex:inputfield value="{!faculty.Faculty_Name__c}"/><br></br><br></br>
<apex:commandButton value="Submit" action="{!submit}"/>
<apex:pageBlock >
<apex:pageblockSection >
<apex:repeat value="{!fd}" var="item">
<apex:outputText value="{!item.Class__c}" />
</apex:repeat>
</apex:pageblockSection>
</apex:pageBlock>
</center>
</apex:form>
</apex:page>
Controller:
public class facultydetails_con {
public time_table__c faculty {get; set;}
public list<time_table__c> fd {get; set;}
public facultydetails_con()
{
list<time_table__c> fd = new list<time_table__c>();
}
public pagereference submit()
{
fd = [select class__c, day__c, faculty_name__c from time_table__c where faculty_name__c = :faculty.faculty_name__c];
return null;
}
}
Thank you,
Satya
Try to use following sample code for your requirement.
Visualforce Page:
Apex Class:
Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/
All Answers
Try to use following sample code for your requirement.
Visualforce Page:
Apex Class:
Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/
Thanks for your response. I am able to get the output now. However, I would like it to display it as a summary table and below is what I get.
Thank you,
Satya
Which layout do you want? can you please post the image of the expected layout.
Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/
Below is the screenshot.
Thank you,
Satya
Thanks in advance.