2022-06-06 16:02:17 +00:00
|
|
|
require('./style.scss');
|
2022-06-06 08:53:59 +00:00
|
|
|
|
|
|
|
module.exports = new Class({
|
|
|
|
Extends: Htk.Column
|
|
|
|
,Tag: 'htk-column-check'
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,initialize(props) {
|
2022-06-06 08:53:59 +00:00
|
|
|
this._cssClass = 'cell-check';
|
2022-06-06 16:02:17 +00:00
|
|
|
Htk.Column.prototype.initialize.call(this, props);
|
2022-06-06 08:53:59 +00:00
|
|
|
}
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,render(tr) {
|
2022-06-06 08:53:59 +00:00
|
|
|
var checkButton = this.createElement('input');
|
|
|
|
checkButton.type = 'checkbox';
|
|
|
|
checkButton.checked = this.value;
|
|
|
|
|
|
|
|
if (this.editable)
|
|
|
|
checkButton.addEventListener('changed',
|
|
|
|
this.inputChanged.bind(this, tr, node));
|
|
|
|
else
|
|
|
|
checkButton.disabled = true;
|
|
|
|
|
2022-06-06 16:02:17 +00:00
|
|
|
var td = Htk.Column.prototype.render.call(this, tr);
|
2022-06-06 08:53:59 +00:00
|
|
|
td.appendChild(checkButton);
|
|
|
|
return td;
|
|
|
|
}
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,inputChanged(tr, node) {
|
2022-06-06 08:53:59 +00:00
|
|
|
this.changed(tr, node.value);
|
|
|
|
}
|
|
|
|
});
|