Java Script is reverse in Google Chrome

50 views
Skip to first unread message

Tushar Mahadik

unread,
May 20, 2014, 2:14:10 AM5/20/14
to salesforce-p...@googlegroups.com
Hi All,
I used select all input check box (Java script) for selecting all districts(<apex:selectCheckBoxes>) and after selection it renders to no of blocks belonging to all districts. This is working fine in Mozilla Firefox and IE .....but in Google chrome it working reverse....i.e. After select all it is not showing all blocks belonging to all districts.....but after uncheck select all check box it shows all blocks belonging to all districts. How to resolve this problem....pls help.... its argent...


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;
}

Charan Vuyyuru

unread,
May 20, 2014, 3:26:05 AM5/20/14
to salesforce-p...@googlegroups.com
Rather you do this.

If user selects Select All checkbox, use action function or action support and call an apex method.

In that method make all the check boxes true.



--
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.



--

Thanks & Regards,

Charan Tej Vuyyuru
Skype: teja_vuyyuru





          

Reply all
Reply to author
Forward
0 new messages