You need to sign in to do that
Don't have an account?
Ankit Gupta SFDCLearner
Get records from global picklist and display in a vf page using wrapper class
Get records from global picklist and display in a vf page using wrapper class
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
public class dispValuesOfaGlobalValues
{
public dispValuesOfaGlobalValues(ApexPages.StandardController controller)
{
}
public List<InnerClass> ListGlobalValue {get; set;}
public List<InnerClass> getListGlobalToDisplay()
{
system.debug('hello');
if(ListGlobalValue == null)
{
ListGlobalValue = new List<InnerClass>();
List<selectOption> options = new List<selectOption>();
Schema.sObjectType sobject_type = xyz__c.getSObjectType(); //grab the sobject that was passed
Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); //describe the sobject
Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap(); //get a map of fields for the passed sobject
List<Schema.PicklistEntry> pick_list_values = field_map.get('field__c').getDescribe().getPickListValues(); //grab the list of picklist values for the passed field on the sobject
for (Schema.PicklistEntry a : pick_list_values) { //for all values in the picklist list
options.add(new selectOption(a.getValue(), a.getLabel())); //add the value and label to our final list
}
system.debug('options: ' + options);
for(integer i=0;i<options.size();i++)
{
string value = (string)options[i].getValue();
ListGlobalValue.add(new RegionList(value));
}
system.debug('ListGlobalValue: ' + ListGlobalValue);
}
return ListGlobalValue ;
}
public class InnerClass
{
public string listClassGlobalValues {get;set;}
public InnerClass(string reg)
{
listClassGlobalValues = reg;
}
}
}
Page:
<apex:page extensions="dispValuesOfaGlobalValues" id="myPage">
<apex:form id="Form">
<table style="width:100%">
<tr>
</tr>
<tr>
</tr>
<tr>
<br/>
</tr>
<tr>
<br/>
</tr>
<br/>
<apex:pageBlock >
<apex:pageBlockTable value="{!ListGlobalToDisplay}" var="c" id="tableRegion">
<apex:column value="{!c.listClassGlobalValues}" headerValue="Global PickList Value" />
</apex:pageBlockTable>
<br/>
</apex:pageBlock>
</table>
</apex:form>
</apex:page>