2014-01-10 2 views
0

여기 hidden_field__c는 체크 박스입니다. VFP에서 사용자가 데이터베이스에서 확인란을 true로 변경하면 여전히 false로 표시되고 반대의 경우에는 내 코드에서 누락 된 부분을 지적 할 수 있습니까? 이것은 내 코드입니다.Salesforce 업데이트 변경 이벤트의 체크 박스 값

----------- 제어기 --------------

public class dataTableCon { 

    List<Account> accounts; 

    public List<Account> getAccounts() { 

     if(accounts == null) accounts = [select name, owner.name,hidden_field__c from account limit 10]; 

     return accounts; 

    } 

} 

--------- VFP -------------

<apex:page controller="dataTableCon" id="page"> 

    <apex:form > 

    <apex:pageBlock id="theBlock"> 

    <apex:dataTable value="{!accounts}" var="account" id="theTable" rowClasses="odd,even" styleClass="tableClass"> 

     <apex:column > 
      <apex:facet name="header">Private</apex:facet> 
      <apex:inputCheckbox value="{!account.hidden_field__c}" > 
      <apex:actionSupport event="onchange" rerender="theBlock"/> 
      </apex:inputCheckbox>   
     </apex:column> 


     <apex:column > 
      <apex:facet name="header">Name</apex:facet> 
      <apex:outputText value="{!account.name}" > 
     </apex:column> 

     <apex:column > 
      <apex:facet name="header">Owner</apex:facet> 
      <apex:outputText value="{!account.owner.name}" > 
     </apex:column> 

    </apex:dataTable> 

    </apex:pageBlock> 
    </apex:form> 
</apex:page> 

답변

0

실제로 변경 내용을 저장하는 메커니즘이 필요합니다. <apex:commandButton>을 < 꼭지점에 추가하십시오 : 양식 >을 입력 한 다음 저장 버튼을 호출하십시오.

에이펙스 :

public PageReference save() 
{ 
    update accounts; 
} 

없이 VisualForce :

<apex:commandButton value="Save" action="{!save}"/>