Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Check all checkboxes in a column of a tabular form

943068Jul 13 2012 — edited Jul 20 2012
Hi,
I think this can be useful for some people.. I have a tabular form with several columns containing checkboxes. I wanted to be able to check or uncheck a whole column. The problem is that I didn't find a function to do this. So I modified (and renamed) the $f_CheckFirstColumn(pNd) function.

In "edit page > JavaScript Function and Global Variable Declaration", add this :
function $f_CheckNthColumn(c,n){
	var e=$x_UpTill(c,"TABLE");
	for(var d=0,a=e.rows.length;d<a;d++){
		var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
		if(b){
			if(b.checked != c.checked) {
				b.click();
			}
		}
	}
	return;
}
EDIT : The status of the checkboxes checked with the function below is not passed when submitting the form (it is passed when clicking on every checkbox). This is why I had to use the click() function (so that onClick is triggered).
--
function $f_CheckNthColumn(c,n){
	var e=$x_UpTill(c,"TABLE");
	var f=[];
	for(var d=0,a=e.rows.length;d<a;d++){
		var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
		if(b){
			f[f.length]=b;
		}
	}
	$f_CheckAll(false,c.checked,f);
	return f;
}
--

And in the report column header :
<input type="checkbox" onClick="$f_CheckNthColumn(this, NUMBER);" />
NUMBER being the column number (1st column containing checkboxes = 0, 2nd column containing checkboxes = 1, etc.)

I'm using APEX 4.1.1.00.23, so I can not guarantee It'll work on other versions.

Hope this can help !

Edited by: ben0123 on Jul 13, 2012 12:12 AM

Edited by: ben0123 on Jul 13, 2012 1:17 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2012
Added on Jul 13 2012
2 comments
469 views