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

59 lines
1.0 KiB
JavaScript

var Entry = require ('./entry');
var ColumnRadio = require ('../column/radio');
module.exports = new Class
({
Extends: Entry
,Tag: 'htk-table'
,render: function ()
{
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: function (model)
{
this.treeview.setModel (model);
model.addSignal ('status-changed', this.modelRefresh, this);
this.selectValue ();
}
,changed: function (rbGroup)
{
this.realValue = this.rbGroup.getValue ();
this.emit ('changed');
}
,selectValue: function ()
{
this.rbGroup.setValue (this.realValue);
}
,setRealValue: function ()
{
this.selectValue ();
}
,modelRefresh: function (model, status)
{
if (status == Db.Model.Status.READY)
this.selectValue ();
}
,setEditable: function (editable)
{
this.rbGroup.setEditable (editable);
}
});