这里,hidden_field__c是一个复选框。在VFP中,如果用户在数据库中将复选框更改为true,则仍然显示为false,反之亦然,请有人指出我的代码中缺少了什么。?这是我的密码。
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> 发布于 2014-01-11 21:08:11
您需要一些实际保存更改的机制。尝试在您的中添加一个,然后让该按钮调用一个保存的操作。
顶点:
public PageReference save()
{
update accounts;
}视力:
<apex:commandButton value="Save" action="{!save}"/>https://stackoverflow.com/questions/21055534
复制相似问题