hedera-web/js/htk/table/index.js

51 lines
946 B
JavaScript

var Entry = require('../entry');
var ColumnRadio = require('../columns/radio');
module.exports = new Class({
Extends: Entry
,Tag: 'htk-table'
,render() {
var tv = new Htk.TreeView();
this.node.appendChild(tv.node);
var renderer = new ColumnRadio();
tv.appendColumn(0, renderer, '');
var rbGroup = renderer.rbGroup;
rbGroup.addSignal('changed', this.changed, this);
this.treeview = tv;
this.rbGroup = rbGroup;
}
,setModel(model) {
this.treeview.setModel(model);
model.addSignal('status-changed', this.modelRefresh, this);
this.selectValue();
}
,changed() {
this.realValue = this.rbGroup.getValue();
this.emit('changed');
}
,selectValue() {
this.rbGroup.setValue(this.realValue);
}
,setRealValue() {
this.selectValue();
}
,modelRefresh(model, status) {
if (status == Db.Model.Status.READY)
this.selectValue();
}
,setEditable(editable) {
this.rbGroup.setEditable(editable);
}
});