You need to sign in to do that
Don't have an account?
ABak
javascript issue
If the top chekcbox in the column within <apex:facet> tags in checked , I would want to check the checkbox in that column.
So its something like check All functionality. Anything with an example would be really helpful.
Heres the code for that column in the pageBlockTable
<apex:column id="colChk"> <apex:facet name="header"> <apex:inputCheckbox id="chkTopCheckBox" onclick="selectCheckboxes();"/> </apex:facet> <apex:inputCheckBox id="chkbox" value="{!row.selected}"/> </apex:column>
You shouldn't even need to write any javascript to do this:
Thanks , this is a nice approach but there seems to be a minor delay in checking and unchecking the boxes (maybe cause its calling the actionsupprt and then redering as compared to the client side javascript which renders instantly) .
Also if I select them and then go to some other page in salesforce and then return back using the browser's (Chrome) back button , I am getting some finicky behaviour . But as soon as I refresh that page it works fine.
Hey Abak
Can you use jQuery in your page? , its a javascript library that can make this a walk in the park.
You can use jQuery to go through all input type checkboxes and mark them.
in your code:
I tend to use a div wrapped around what i need, so its easier and cleaner code than using {!component.XYZ}.
The jQuery code would look something like this :
This will set the attribute "checked" to "checked" , i think this was // the standards accepted value isntead of true, but dont remember now with jQuery you can use CSS selectors to get DOM elements in this case #myCheckboxes input:checkbox which is the same as input[type=checkbox].
learn more about jquery here:
http://jquery.com/
http://api.jquery.com/checkbox-selector/
I think its the best lib around for this kind of stuff.
Hope this helps,
Gaston.