我正在尝试从Project_Join__c返回一个记录列表,这些记录在Field number__c中有一个值,该值与我在单击调用vf页面的按钮的记录中的值相匹配。我尝试保存页面时收到错误:未知属性' VisualforceArrayList.number__c错误。
控制器:
public class Controller_ProjectJoin_Match{
//Set Booleans
public boolean showNumber {get; set;}
//Passing parameter from button to class
String pnumber= ApexPages.currentPage().getParameters().get('num');
public string PassedNum ='';p
Project_Join__c pj1 = [select number__c from Project_Join__c where number__c =: pnumber limit 1];
public List<Project_Join__c> projectJoin{get; set;}
public Controller_ProjectJoin_Match(){
passedNum = pj1.number__c;
showNumber = true;
if (pnumber != ''){
projectJoin = [SELECT Number__c FROM Project_Join__c WHERE number__c =: passedNum];}
}
}
页:
<apex:pageBlock mode="edit" title="Project Join matching list:">
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!projectJoin}" var="projectJoin">
<apex:column headerValue="Number" rendered="{!showNumber}">
<apex:outputField value="{!projectJoin.number__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
按钮:
/apex/Controller_ProjectJoin_Match?num={!Project_Join__c.Number__c}
答案 0 :(得分:1)
在pageBlockTable中,var属性是列表中对象的名称而不是列表本身,因此最好给它一个不同的名称。像这样:
<apex:pageBlockTable value="{!projectJoin}" var="projectJoinObj">
然后你可以在pageBlockTable
中引用它<apex:outputField value="{!projectJoinObj.number__c}"/>