Provide a master checkbox before all record rows means if user selects that all records will be selected.
- Create VisualForce Component for master check Box.
Component >>
<apex:component > <script> function cvCheckAllOrNone(allOrNoneCheckbox) { // Find parent table var container = allOrNoneCheckbox; while (container.tagName != "TABLE") { container = container.parentNode; } // Switch all checkboxes var inputs = container.getElementsByTagName("input"); var checked = allOrNoneCheckbox.checked; for (var i = 0; i < inputs.length; i++) { var input = inputs.item(i); if (input.type == "checkbox") { if (input != allOrNoneCheckbox) { input.checked = checked; } } } } </script> <apex:inputCheckbox onclick="cvCheckAllOrNone(this)" title="Toggle All Rows"/> </apex:component>
You can add a checkbox to the header row of your checkbox column that uses it to check all or none of the checkboxes:
In visualforce page add the component.
<apex:column > <apex:facet name="header"> <c:CheckAllOrNone /> </apex:facet> <apex:inputCheckbox value="YOUrCheckBoxValue"/> </apex:column>As this runs at the client side it is nice and quick.
No comments:
Post a Comment