<html>
<head>
<title></title>
<style>body {font: 12px Tahoma}</style>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
<style>
#myGrid .aw-column-0 {width: 100px;}
#myGrid .aw-column-1 {width: 150px}
</style>
</head>
<body>
<span id="myGrid"></span>
<script>
var myData = [
[false, "unprotect"],
[false, "protect"],
[true, "unprotect"],
[true, "protect"]
];
MyCheckbox = AW.Templates.Checkbox.subclass();
MyCheckbox.create = function() {
var obj = this.prototype;
obj.setContent("box/text", "");
obj.setClass("disabled", function() {
if (this.$1 != null) {
if (this.$owner.getCellText(1, this.$1) == "protect") {
return "control";
}
}
return "";
});
obj.setEvent("onclick", function(event){
if (this.$1 != null) {
if (this.$owner.getCellText(1, this.$1) != "protect") {
var value = this.getControlProperty("value");
this.setControlProperty("value", !value);
}
}
});
}
var myHeaders = ["checkbox", "calue"];
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setHeaderText(myHeaders);
grid.setCellData(myData);
grid.setCellTemplate(new MyCheckbox, 0);
grid.setColumnCount(2);
grid.setRowCount(4);
grid.refresh();
</script>
</body>
</html>
This topic is archived.