27 lines
480 B
JavaScript
27 lines
480 B
JavaScript
|
|
module.exports = new Class({
|
|
Extends: Htk.Field
|
|
,Tag: 'htk-check'
|
|
|
|
,render: function() {
|
|
var node = this.createRoot('input');
|
|
node.type = 'checkbox';
|
|
node.addEventListener('change', this.changed.bind(this));
|
|
}
|
|
|
|
,changed: function() {
|
|
this.valueChanged(this.node.checked);
|
|
}
|
|
|
|
,putValue: function(value) {
|
|
if (value)
|
|
this.node.checked = true;
|
|
else
|
|
this.node.checked = false;
|
|
}
|
|
|
|
,setEditable: function(editable) {
|
|
this.node.disabled = !editable;
|
|
}
|
|
});
|