I am working with visualforce and trying to set up SelectOption over the records fetched through a SOQL query. I want to populate the records in a field to a DropDown List in my VF page.
While using System.debug, results are as desired but vf page is not showing the result. Unable to understand the problem with the code
<apex:page Controller="PermissionSetCtrl">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable var="st" value="{!qry}">
<apex:column headervalue="Profile" >
<apex:outputText value="{!st.Profile.Name}"/>
</apex:column>
<apex:column >
<apex:selectList value="{!objSelected}" multiselect="false" size="1">
<apex:selectOptions value="{!Objectlist}" />
</apex:selectList>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!listobj}" var="a1">
<apex:column headerValue="sObject" value="{!a1.SobjectType}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
And the Controller to the vf Page:
public class PermissionSetCtrl {
public List<PermissionSet> qry {get; set;}
Public List<SelectOption> Objectlist {get; set;}
public List<ObjectPermissions> listobj {get; set;}
public String objSelected {get; set;}
Public List<SelectOption> getObjectlist(){
system.debug('getObjectlist called!');
List<SelectOption> options = new List<SelectOption>();
for(ObjectPermissions lst : listobj){
options.add(new SelectOption(lst.SobjectType, lst.SobjectType));
}
System.debug(options);
return options;
}
public PermissionSetCtrl(){
system.debug('constructor called!');
List<string> objlist = new List<String>();
qry = [SELECT Id, Profile.Name,(Select SObjectType from ObjectPerms) from PermissionSet WHERE Id IN (SELECT ParentId FROM ObjectPermissions WHERE SObjectType = 'Account' AND PermissionsRead = true) limit 5];
for(PermissionSet s : qry){
listobj = s.ObjectPerms;
}
getObjectlist();
}
}