3.0 beta 2

v2b3 setting checkboxes problem

I want to set the checkboxes in the grid dynamically. The below code for some reason doesn't work when I set
setCellValue=function(ifchecked, 10). Could anyone tell me why?

obj.setCellTemplate(new AW.Templates.Checkbox, 10);
obj.setCellValue=function(ifchecked, 10){
for(i=0; i<rows; i++)
{
if(obj.getCellValue(10, i)==0) return ifchecked=false;
else if(obj.getCellValue(10, i)==1) return ifchecked=true;
else return fchecked=false;
}


};
lw
December 29,
Nevermind everyone, I got it. Here is the code:

obj.setCellValue(check(), 10);
function check(){

for(i=0; i<rows; i++)
{

if(obj.getCellValue(10, i)==0) return false;
else if(obj.getCellValue(10, i)==1) return true;
else return false;
}

}
lw
December 29,
I didn't get this code function properly yet.
Does anyone know how to make it work?
lw
December 29,
I finally got the my grid's checkboxes function, be checked on 1 and unchecked on 0 ON PAGE LOAD.
Here is the code:

function setCheckbox()
{
var curval=0;
var curbool=false;
for(i=0; i<rows; i++)
{
curval= chbox[i];
if(curval!=0)
{
curbool=true;
obj.setCellTemplate(new AW.Templates.Checkbox, 10, i);
obj.setCellValue(curbool, 10,i);
}
else{
curbool=false;
obj.setCellTemplate(new AW.Templates.Checkbox, 10, i);
obj.setCellValue(curbool, 10,i);
}
}
}
lw
December 30,
lw,

I have tried your code and so far have not been able to get past an undefined error. Elsewhere do you have chbox[i] defined? if you could post the portion where you call this code that would be much appreciated.
cs
January 4,
Try this:

// awGrid is my grid obj
// my checkboxes are in the first column (0)

var column = 0;
function toggleCheckBoxes(checked) {
    for(i=0;i < awGrid.getrowcount();i++) {
        awGrid.setCellValue(checked, column, i)
    }
}
Geno
February 2,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.