You need to sign in to do that
Don't have an account?
Unknown property 'ApexPages.StandardSetController'
Hi all,
I'm trying to build a dataList with data from a query with a sub-query. This is the VF markup:
<apex:page standardController="Application__c" extensions="getDataFinalReport" tabStyle="Application__c" > <apex:pageBlock title="Candidates"> <apex:form id="theForm"> <apex:pageBlockSection showHeader="true" title="List of Candidates" > <apex:dataList var="a" value="{!can}" type="1"> <apex:outputText value="{!can.Candidate_Full_Name__c}"/> </apex:dataList> </apex:pageBlockSection> </apex:form> </apex:pageBlock> </apex:page>
And this is the controller extension:
public with sharing class getDataFinalReport { public getDataFinalReport(ApexPages.StandardController controller) { } string JobOrderId = ApexPages.currentPage().getParameters().get('id'); public ApexPages.StandardSetController can { get { if(can == null) { can = new ApexPages.StandardSetController(Database.getQueryLocator( [SELECT (SELECT Candidate_Full_Name__c FROM Application__c) FROM Job_Order t WHERE Id=:JobOrderId])); } return can; } set; } // Initialize can and return a list of records public List<ts2__Application__c > getCandidateLines() { return (List<ts2__Application__c >) can.getRecords(); } }
The problem now is that, when I try to save the VF gives me the following error:
Error: Unknown property 'ApexPages.StandardSetController.Candidate_Full_Name__c'
I tried creating the get/set for Candidate_Full_Name__c but it doesn't work either , can anyone help me with this?
Many thanks,
MGA
You can try something along the lines of this:
You might need to rewrite the candidates = jo.Application__C line to get the applicants out. The better way would be to figure out what the field that relates Application__c and Job_Order and do the query directly off of Application__c
All Answers
Hi,
I think you have forgotten to mention the var value inside the outputtext instead of listvalue.
Try the below code:
<apex:dataList var="a" value="{!can}" type="1">
<apex:outputText value="{!a.Candidate_Full_Name__c}"/>
</apex:dataList>
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi Navatar_DbSup,
No, it didn't work, It gives me the same error.
I think is something related with getters/setters, but I can't come up with a solution.
MGA
This looks a little confused to me. "can" is an instance of a StandardSetController, but you are trying to use it as the value for a datalist component, which requires a collection (e.g. list) of data.
The visualforce developer's guide has the following example, which initialises the controller but then passes the records back to the page:
You can try something along the lines of this:
You might need to rewrite the candidates = jo.Application__C line to get the applicants out. The better way would be to figure out what the field that relates Application__c and Job_Order and do the query directly off of Application__c
I have the following Apex method with Sub query SOQL:
How can I access the sub query fields in my Visualforce page? Below is my Visualforce code. Is says it does not understand co.Contact or co.Opportunity. Please assist with solution.