You need to sign in to do that
Don't have an account?
Harsha Shri
Help in Select all functionality for check box
Hi All,
I have written code for check box select all functionality. It is working, but is having one issue please help me. I am sharing my code.
Here if I check main check box, it is selecting all checkboxes under it. If I am unselecting all, it is unselecting all.
But issue is, If I unselect any check box from result check box main checkbox is not getting unselected. the below image is reference. 1st check is main check box. when I deselect 3rd checkbox the 1st one should uncheck. right now it is not happening. Please help me
Thanks in Advance
I have written code for check box select all functionality. It is working, but is having one issue please help me. I am sharing my code.
public class Mainclass{ public WrapperClass viewWrapper {get;set;} public void SelectAll(){ if(viewwrapper.check){ for(WrapperClass.SearchItem s : viewWrapper.resultList) { s.checked = true; } } else { for(WrapperClass.SearchItem s : viewWrapper.resultList) { s.checked = false; } } } }
public class WrapperClass { public Boolean check{get;set;} public List<SearchItem> resultList{ get; set; } public class SearchItem { public Boolean checked{ get; set; } \\ some other fields are also there } }
<apex:page> <apex:form> <apex:coloumn> <apex:facet> <apex:inputCheckbox style="margin:2px;" value="{!viewWrapper.check}"> <apex:actionSupport action="{!selectAll}" event="onclick" reRender="resultsBlock"/></apex:inputCheckbox> </apex:facet> </apex:coloumn> </apex:form> </apex:page>
Here if I check main check box, it is selecting all checkboxes under it. If I am unselecting all, it is unselecting all.
But issue is, If I unselect any check box from result check box main checkbox is not getting unselected. the below image is reference. 1st check is main check box. when I deselect 3rd checkbox the 1st one should uncheck. right now it is not happening. Please help me
Thanks in Advance
Hi harsha Shri,
Its easy to achieve required logic,
Dear, If it helps you than let me know otherwise tell me if problem still exist.please check some help below :
Thanks,
Satish.
All Answers
Hello Harsha,
When look it into your VF page code than Its looks like it not full code,
Please share all code than we can understand more about problem.
And in VF page single checkbox code is shown, and in image you shown more than one checkbox.
please share more about your problem, So, Good people can help you.
Thanks,
Satish. :-)
HI Satish,
the 1st checkbox will be used for select all buttom. below checkboxes are results of records from wrapper list.
Hi harsha Shri,
Its easy to achieve required logic,
Dear, If it helps you than let me know otherwise tell me if problem still exist.please check some help below :
Thanks,
Satish.
Hi harsha Shri,
please correct Line #6
if(s.checked == true)