forked from verdnatura/hedera-web
56 lines
1023 B
JavaScript
56 lines
1023 B
JavaScript
Htk.Table = new Class
|
|
({
|
|
Extends: Htk.Entry
|
|
,Tag: 'htk-table'
|
|
|
|
,initialize: function (props)
|
|
{
|
|
var tv = new Htk.TreeView ();
|
|
this.node.appendChild (tv.getNode ());
|
|
|
|
var renderer = new Htk.CellRendererRadio ();
|
|
tv.appendColumn (0, renderer, '');
|
|
|
|
var rbGroup = renderer.rbGroup;
|
|
rbGroup.addSignal ('changed', this.changed, this);
|
|
|
|
this.treeview = tv;
|
|
this.rbGroup = rbGroup;
|
|
this.parent (props);
|
|
}
|
|
|
|
,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.signalEmit ('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);
|
|
}
|
|
});
|