obj.setContent("box/text", function() {return this.getControlProperty("value") ? 'Yes' : 'No'});
// my checkbox
My.CheckBox = AW.Templates.ImageText.subclass();
My.CheckBox.create = function () {
var obj = this.prototype;
obj.setClass("value", function () {
return this.getControlProperty("value") == 'Y';
});
obj.setClass("toggle", "checkbox");
obj.setClass("templates", "checkbox");
obj.setAttribute("awx", "toggle");
var marker = new AW.HTML.SPAN;
marker.setClass("item", "marker");
obj.setContent("box/marker", marker);
obj.setContent("box/text", function() {return (this.getControlProperty("value") == 'Y') ? 'Yes' : 'No'});
obj.setEvent("onclick", function () {
var value = this.getControlProperty("value");
this.setControlProperty("value", (value == 'Y') ? 'N' : 'Y');
});
obj.startEdit = null;
};
var obj = new AW.UI.Grid; // your grid
...
...
var chk= new AW.Templates.Checkbox; // create checkbox template
chk.setContent("box/text", function() {return this.getControlProperty("value") ? "Yes" : "No"}); // magic here
obj.setCellTemplate(checkbox, 4); // fifth column is checkbox
...
document.write(obj); // write grid
obj.setCellTemplate(checkbox, 4); // fifth column is checkbox
obj.setCellTemplate(chk, 4); // fifth column is checkbox
This topic is archived.