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

51 lines
1016 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-05-30 01:30:33 +00:00
,render: function() {
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-05-30 01:30:33 +00:00
,setModel: function(model) {
this.treeview.setModel(model);
model.addSignal('status-changed', this.modelRefresh, this);
this.selectValue();
}
2022-05-30 01:30:33 +00:00
,changed: function() {
this.realValue = this.rbGroup.getValue();
this.emit('changed');
}
2022-05-30 01:30:33 +00:00
,selectValue: function() {
this.rbGroup.setValue(this.realValue);
}
2022-05-30 01:30:33 +00:00
,setRealValue: function() {
this.selectValue();
}
2022-05-30 01:30:33 +00:00
,modelRefresh: function(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-05-30 01:30:33 +00:00
,setEditable: function(editable) {
this.rbGroup.setEditable(editable);
}
});