0
1
Fork 0
hedera-web-mindshore/js/htk/table/index.js

51 lines
946 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
2022-06-06 08:53:59 +00:00
var Entry = require('../entry');
2022-06-06 12:49:18 +00:00
var ColumnRadio = require('../columns/radio');
2016-09-26 09:28:47 +00:00
2022-05-30 01:30:33 +00:00
module.exports = new Class({
2016-09-26 09:28:47 +00:00
Extends: Entry
,Tag: 'htk-table'
2022-11-16 01:46:44 +00:00
,render() {
2022-05-30 01:30:33 +00:00
var tv = new Htk.TreeView();
this.node.appendChild(tv.node);
2022-05-30 01:30:33 +00:00
var renderer = new ColumnRadio();
tv.appendColumn(0, renderer, '');
var rbGroup = renderer.rbGroup;
2022-05-30 01:30:33 +00:00
rbGroup.addSignal('changed', this.changed, this);
this.treeview = tv;
this.rbGroup = rbGroup;
}
2022-11-16 01:46:44 +00:00
,setModel(model) {
2022-05-30 01:30:33 +00:00
this.treeview.setModel(model);
model.addSignal('status-changed', this.modelRefresh, this);
this.selectValue();
}
2022-11-16 01:46:44 +00:00
,changed() {
2022-05-30 01:30:33 +00:00
this.realValue = this.rbGroup.getValue();
this.emit('changed');
}
2022-11-16 01:46:44 +00:00
,selectValue() {
2022-05-30 01:30:33 +00:00
this.rbGroup.setValue(this.realValue);
}
2022-11-16 01:46:44 +00:00
,setRealValue() {
2022-05-30 01:30:33 +00:00
this.selectValue();
}
2022-11-16 01:46:44 +00:00
,modelRefresh(model, status) {
2016-09-26 09:28:47 +00:00
if (status == Db.Model.Status.READY)
2022-05-30 01:30:33 +00:00
this.selectValue();
}
2022-11-16 01:46:44 +00:00
,setEditable(editable) {
2022-05-30 01:30:33 +00:00
this.rbGroup.setEditable(editable);
}
});