Tuesday, 24 March 2009

Check All / Uncheck All Checkbox

There is a really cool JavaScript function in Apex called: $f_CheckFirstColumn that allows you to Check / Uncheck all checkboxes that exist in the 1st column position of a Tabular Form / Report.

To implement this, all you need do is add the following HTML to the Column Heading of the 1st Column in your Tabular Form (i.e. the Checkbox Column):

<input type="Checkbox" onclick="$f_CheckFirstColumn(this)">

Check out an example here


Anonymous said...

Hello Duncan,

in your example if i click in the header for check all, all checkboxes are checked but next second all checkboxes are unchecked.

Is this a bug or a feature? ;-)


Unknown said...

Hi Carsten

No this was a bug. I had sorting on the checkbox column enabled which was causing some issues. This has been removed and the example is now working as intended!

Thanks for pointing that out.


Anonymous said...

Hi Duncan,

Your are an intelligent.

I want to have a procedure for how to make all the checkboxes to be deselected when anyone of the checkbox is clicked.
Kindly provide me your help.


Tim Ward said...

This actually seems to work for any column.

Anonymous said...

Thaaaanks you just the best

Jessie said...

Works GREAT - thanks much!

Jessie said...

Works GREAT - thanks much!!