Tips for CheckBox Template
To show 'Yes' and 'No' after checkbox :-)
My checkbox template when my data is not Boolean but 'Y' & 'N' :-)
It is hardcoded to Y/N for now, but shall develop more generic class to have APIs like following.
// chk.defineCheckedProperty("true", "Y");
// chk.defineCheckedProperty("false", "N");
Cheers,
Sudhaker
http://thej2ee.com (active again)
obj.setContent("box/text", function() {return this.getControlProperty("value") ? 'Yes' : 'No'});
My checkbox template when my data is not Boolean but 'Y' & 'N' :-)
// 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;
};
It is hardcoded to Y/N for now, but shall develop more generic class to have APIs like following.
// chk.defineCheckedProperty("true", "Y");
// chk.defineCheckedProperty("false", "N");
Cheers,
Sudhaker
http://thej2ee.com (active again)
Sudhaker Raj
February 13,