3.2.0

Checkbox (checked / unchecked) based on values in grid

Hello,

I'm loading my grid from PHP MySQL. When I'm trying to set a column as a checkbox based on the value in there, the grid returns 'undefined', can someone help me with my code?

Thanks in advance!

// Set grid text
obj.setHeaderText(myHeaders);
obj.setCellText(function(c,r){return CellData[r][c]} );
// obj.setCellText(myCells); // Original fill method - DO NOT USE this method to fill grid. Because of the checkboxes!

// Checkboxes
// add a checkbox to col 8 (the 9th col)
obj.setCellTemplate(new AW.Templates.Checkbox, 8);

// set initial VALUE for column 2 From the CellData array NOTE: MUST BE SET to Boolean true/false.
obj.setCellValue(function(col, row){return CellData[row][8]==1 ? true : false}, 8);
John P.
July 27,
I got a partial solution, but how do I remove the value in the grid next to the checkbox now?

// add a checkbox to col 8 (the 9th col)
obj.setCellTemplate(new AW.Templates.Checkbox, 8);

// set initial VALUE for column 8 From the CellData array NOTE: MUST BE SET to Boolean true/false.
obj.setCellValue(function(col, row){return this.getCellText(8, row)=="1" ? true : false}, 8);
John P.
July 27,
Try

obj.setCellText(function(c,r){return c == 8 ? "" : CellData[r][c]} );
Bryn
July 28,

This topic is archived.

See also:


Back to support forum