Apex Class:
public class checkcontact {
public list<contact> con {get;set;}
public boolean cc{get;set;}
public checkcontact() {
con=new list<contact>();
cc=true;
con=[select name,email from contact];
}
public void change() {
if(cc==false)
cc=true;
else
cc=true;
}
}
VisualForce Page:
<apex:page controller="checkcontact">
<apex:form >
<apex:outputPanel id="p1">
<apex:pageBlock >
<apex:pageBlockTable value="{!con}" var="conlist" >
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox value="{!cc}" onclick="change('{!cc}');alert('{!cc}');" />
</apex:facet>
<apex:inputCheckbox selected="true" value="{!cc}" />
</apex:column>
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!conlist.name}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!conlist.Email}
</apex:column>
</apex:pageBlockTable>
<apex:actionFunction action="{!change}" name="change" oncomplete="alert('hello');" reRender="p1">
<apex:param name="abc" assignTo="{!cc}" value=""/>
</apex:actionfunction>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
No comments:
Post a Comment