3.2.0

enable/disable all checkboxes from one checkbox in the header

I would like to enable/disable all checkboxes from one checkbox in the header. So far I have this function:
function togglecheckBoxes(rowMax) {
if(document.getElementsByName("listSelection")[0].checked==true){
for(i=0; i<rowMax; i++)
{
document.getElementsByName("listSelection"+i)[0].checked=true;
}
}
else {
for(i=0; i<rowMax; i++)
{
document.getElementsByName("listSelection"+i)[0].checked=false;
}
}
}

I call this function from my header definition:
"<input type='checkbox' name='listSelection' onclick=togglecheckBoxes(6);>"

The column with the checkboxes should have no order funtionality. I use this:
var _sort = obj.sort;

obj.sort = function(index, direction){
if (index == 1){
return;
}
else {
_sort.call(this, index, direction);
}
};

The problem is now that in this way there is no possibility to check the checkbox in the header anymore. It's only working in this way:
obj.getTemplate("top/item").setEvent("onmousedown", null);
but is not what i want, because the other columns must have order functionality.

Is there another (maybe more elegant) way to solve this problem.

Thanks!
Krokus
March 13,

This topic is archived.

See also:


Back to support forum