obj.setCellTemplate(new AW.Templates.Checkbox, 1);
obj.setCellText("some text", 1);
obj.setCellImage("favorites", 1);
obj.setCellValue(false, 1);
<html>
<head>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<input type=button value="See What's Checked" onClick="getChecked();"><br>
<script>
var obj = new AW.UI.Grid;
obj.setControlSize(600, 250);
obj.setCellText(function(i, j){return j + "-" + i});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(15);
// this is 'normal' checkbox
// it changes cell 'value', not selection
obj.setCellTemplate(new AW.Templates.Checkbox, 2);
// set initial value for column 2
obj.setCellValue(false, 2);
// needed to get "checked" state
obj.setCellText(function(col, row){return this.getCellValue(col, row) ? "yes" : "no"}, 2);
document.write(obj);
obj.onCellValueChanged = function(value, column, row){
window.status = "Cell " + column + "." + row + " changed to " + value;
}
function getChecked() {
for(var i=0;i<obj.getRowCount();i++) {
if(obj.getCellValue(2,i)) {
alert(i);
}
}
}
</script>
</body>
</html>
<?php <html>
<head>
<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<input type=button value="See What's Checked" onClick="getChecked();"><br>
<script>
var myData = [["1","2","function(col, row){return this.getCellValue(col, row) ? \"yes\" : \"no\"}","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"],
["1","2","help","4","5","6","7","8","9","10"]
];
var obj = new AW.UI.Grid;
obj.setControlSize(600, 250);
// obj.setCellText(function(i, j){return j + "-" + i});
obj.setCellText(myData); // 2-dimensional js array // NEW LINE
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(15);
// this is 'normal' checkbox
// it changes cell 'value', not selection
obj.setCellTemplate(new AW.Templates.Checkbox, 2);
// set initial value for column 2
obj.setCellValue(false, 2);
// needed to get "checked" state
obj.setCellText(function(col, row){return this.getCellValue(col, row) ? "yes" : "no"}, 2);
document.write(obj);
obj.onCellValueChanged = function(value, column, row){
window.status = "Cell " + column + "." + row + " changed to " + value;
}
function getChecked() {
for(var i=0;i<obj.getRowCount();i++) {
if(obj.getCellValue(2,i)) {
alert(i);
}
}
}
</script>
</body>
</html>
<html>
<head>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<input type=button value="See What's Checked" onClick="getChecked();"><br>
<script>
var obj = new AW.UI.Grid;
obj.setControlSize(600, 250);
obj.setHeaderText("header");
// obj.setCellText(function(i, j){return j + "-" + i});
/********** CHANGES ****************/
var data = [
["0-0", "0-1", false],
["1-0", "1-1", false],
["2-0", "2-1", false]
];
// obj.setCellText(data);
obj.setCellText(function(i, j){return data[j][i]});
/********** END CHANGES ************/
obj.setColumnCount(3);
obj.setRowCount(3);
// this is 'normal' checkbox
// it changes cell 'value', not selection
obj.setCellTemplate(new AW.Templates.Checkbox, 2);
// set initial value for column 2
obj.setCellValue(false, 2);
// needed to get "checked" state
obj.setCellText(function(col, row){return this.getCellValue(col, row) ? "yes" : "no"}, 2);
document.write(obj);
obj.onCellValueChanged = function(value, column, row){
window.status = "Cell " + column + "." + row + " changed to " + value;
}
function getChecked() {
for(var i=0;i<obj.getRowCount();i++) {
if(obj.getCellValue(2,i)) {
alert(i);
}
}
}
</script>
</body>
</html>
grid.setCellTemplate(new AW.Templates.Checkbox, myBooleanColumn);
grid.setCellText(function(col, row){return ""}, myBooleanColumn);
myTemplate.setTextVisible(false)
would be nice?obj.setCellText(function(i, j){return j + "-" + i});
obj.setCellText(myArray);
obj.setContent("box/text", function() {return this.getControlProperty("value") ? 'Yes' : 'No'});
This topic is archived.