0
我需要在pageblocktable中顯示所有的自定義對象記錄。在填充所有記錄之前,我需要添加一個選項列表值,複選框放在第一行,然後填充所有記錄。我怎樣才能做到這一點。如何在pagepagetable行中添加複選框?
Name Satisfy Opportunity Status Last modified
Status(Picklist)
Turn on all checkbox Turn on all checkbox
Clear all Clear all
Test 1 Checkbox Checkbox 12/12/2014
Test 2 Checkbox Checkbox 12/12/2014
Test 3 Checkbox Checkbox 12/12/2014
VF代碼:
<apex:page standardcontroller="Opportunity" extensions="oppgapstatus">
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection id="Info">
<apex:pageBlockTable value="{!WrapperList}" var="wraprec">
<apex:column value="{!wraprec.accRec.Name__c}"/>
<apex:column value="{!wraprec.accRec.Satisfied__c}"/>
<apex:column value="{!wraprec.accRec.Current_Status__c}"/>
<apex:column value="{!wraprec.accRec.LastModifiedDate}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandbutton value="Save" action="{!UpdateSelectedRecords}"/>
<apex:commandbutton value="Cancel"/>
</apex:pageBlock>
</apex:form>
</apex:page>
的Apex類:
Public class oppgapstatus{
Public Opportunity optyList{get;set;}
Public Opportunity_Status__c opst{get;set;}
public PageReference openPresentationOptions() {
return null;
}
private ApexPages.StandardController controller;
public oppgapstatus(ApexPages.StandardController controller) {
}
//Checkbox selectall
Public List<wrapperclass> wrapList {get;set;}
Public boolean checked{get;set;}
Public string selectedField {get;set;}
Public string inputVal{get;set;}
Public void selectallnone(){
if(!checked)
checked = true;
else
checked = false;
}
Public List<wrapperclass> getWrapperList(){
wrapList = New List<wrapperclass>();
for(Opportunity_Status__c acc:[select name,Satisfied__c,Current_Status__c,LastModifiedDate from Opportunity_Gaps__c where Opportunity_Detail__c =: optyList.Id]){
if(!checked)
wrapList.add(New wrapperclass(acc,false));
else
wrapList.add(New wrapperclass(acc,true));
}
return wrapList;
}
Public class wrapperclass{
Public Opportunity_Status__c accRec{get;set;}
Public boolean checkFlag{get;set;}
Public wrapperclass(Opportunity_Status__c acc,boolean flag){
accRec = acc;
checkFlag = flag;
}
}
誰能幫助me..thanks提前