Java Script:
<script type="text/javascript">
function checkAll(cb,cbid)
{
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++)
{
if(inputElem[i].id.indexOf(cbid)!=-1){
inputElem[i].checked = cb.checked;
}
}
}
</script>
VF code:
<font face="calibri" size="3"><b>Select District :</b> </font>
<apex:selectCheckboxes value="{!district}" style="width:150px;align:Left;background-color: #fff;border-style: solid;border-color:#D2691E;border-width:2px" id="select_dist" layout="pageDirection" >
<apex:inputCheckbox onclick="checkAll(this,'select_dist')" >
<apex:actionsupport event="onchange" rerender="child_blocks"/>
</apex:inputCheckbox>Select All
<apex:SelectOptions value="{!Dist}"/>
<apex:actionsupport event="onchange" rerender="child_blocks"/>
</apex:selectCheckboxes> <td >
<!-- List for Blocks -->
<apex:selectCheckboxes value="{!block}" style="width:150px;align:Left;background-color: #fff;border-style: solid;border-color:#D2691E;border-width:2px" id="child_blocks" layout="pageDirection">
<font face="calibri" size="3"><b>Select Block :</b> </font>
<apex:SelectOptions value="{!AttBlocks}"/><apex:inputCheckbox onclick="checkAll(this,'child_blocks')" id="select_all" />Select All
</apex:selectCheckboxes>
</td>
Apex code:
public void setDistrict(String[] district)
{this.district=district;
}
public String[] getDistrict(){
return district;
}
public void setBlock(String[] block)
{this.block=block;
}
public String[] getBlock(){
return block;
} public List<SelectOption> getDist()
{
List<School_Report_Card__c> lstDist = new List<School_Report_Card__c>();
system.debug('Selected states'+states);
lstDist = [Select District__c from School_Report_Card__c where Submission_No__c != null AND Name =: states order by District__c];
mapState.clear();
List<SelectOption> optionList = new List<SelectOption>();
for(School_Report_Card__c src : lstDist)
{
if(!mapState.containskey(src.District__c))
{
optionList.add (new SelectOption(src.District__c, src.District__c));
mapState.put(src.District__c,src);
}
}
return optionList;
}
public List<SelectOption> getAttBlocks()
{
List<School_Report_Card__c> lstSchoolStatesBlocks = new List<School_Report_Card__c>();
system.debug('selectd Dist'+district);
lstSchoolStatesBlocks = [Select Block__c from School_Report_Card__c where Submission_No__c != null AND Name =: states AND District__c=: district order by Block__c];
system.debug('selectd block'+block);
mapState.clear();
List<SelectOption> optionList = new List<SelectOption>();
for(School_Report_Card__c src : lstSchoolStatesBlocks)
{
if(!mapState.containskey(src.Block__c))
{
optionList.add (new SelectOption(src.Block__c, src.Block__c));
mapState.put(src.Block__c,src);
}
}
return optionList;
}
--
You received this message because you are subscribed to the Google Groups "salesforce professionals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salesforce-profess...@googlegroups.com.
To post to this group, send email to salesforce-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/salesforce-professionals.
For more options, visit https://groups.google.com/d/optout.