I have hotel object where custom pick-list field days I need to get days field values(Sunday to Saturday) in table header by using vf page dynamically. I wrote an apex class where i get all value but i am unable to implement in vf page how to do it?
Apex class:
public with sharing class dayextension {
public List<string> stages {get;set;}
public List<string> types {get;set;}
Public Hotel__c hotel {get;set;}
public boolean displayPopup {get; set;}
public dayextension (ApexPages.StandardController controller) {
stages = new list<string>();
types = new list<string>();
Schema.DescribeFieldResult fieldResult = Hotel__c.Days__c.getDescribe();
System.debug(fieldResult);
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
system.debug('--ple -->>'+ple);
for( Schema.PicklistEntry f : ple){
stages.add(f.getLabel());
}
hotel = [select id,Days__c from Hotel__c where id=: controller.getRecord().id];
system.debug('--hotel-->>'+hotel);
}
}
Vf Page:
<apex:page standardController="Hotel__c" extensions="dayextension">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!stages}" var="dbItem">
<apex:repeat value="{!stages}">
<apex:column value="{!hotel.Days__c}"/>
</apex:repeat>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>