How about this (nb: pseudocode only)
var e = actionForm.elements[i];
if (e.type == 'checkbox') && (e.id.endsWith(":myComponentId")) {
e.checked=true;
}
On Sun, 2006-01-22 at 18:23 -0800, Dave wrote:
> I have a dataTable. the first column is checkbox(s) for selection. but
> other columns have checkbox(s) too. How to select all checkbox(s) in
> the first column, not other columns?
>
> Thanks.
>
> Matias Gomez Carabias <[EMAIL PROTECTED]> wrote:
> If those are the only checkboxes in a form you can do the
> following:
>
>
> f
> function selectAllCheckBox(actionForm){
>
> for ( i = 0; i < actionForm.elements.length; i++ )
> {
> if (actionForm.elements[i].type ==
> 'checkbox' ) {
>
> &nbs p;
> actionForm.elements[i].checked = true;
>
> }
>
> }
>
> }
>
> function clearAllCheckBox(actionForm){
>
> for ( i = 0; i < actionForm.elements.length; i++ )
> {
> if (actionForm.elements[i].type ==
> 'checkbox' ) {
>
>
> actionForm.elements[i].checked = false;
>
> }
>
> }
>
> }
>
>
> function invertCheckBox(actionForm){
>
> for ( i = 0; i < actionForm.elements.length; i++ )
> {
> if (actionForm.elements[i].type ==
> 'checkbox' ) {
>
> if
> (actionForm.elements[i].checked == true) {
>
>
> actionForm.elements[i].checked = false;
>
> }
> else {
>
>
> actionForm.elements[i].checked = true;
> <
> SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY:
> Arial">
> }
>
> }
>
>
> }
>
> }
>
> -----Original Message-----
> From: Emily Gu [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 06, 2006 5:04 PM
> To: [email protected]
> Subject: How to do JavaScript select all and de-selected all
> for checkboxes in t:dataTable
>
> Hi,
>
> I am using <t:dataTable> to show the first column as the
> checkbox for each row. Is there a way to add "select all" and
> "de-select all" JavaScript into these checkboxes? I don't want
> to go back to the server side to do such simple thing. Please
> shed some lights.
>
> Thanks for your help!
> Emily
>
>
>
>
> ______________________________________________________________________
> Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more
> on new and used cars.