hedera-web/js/htk/field/entry.js

39 lines
591 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
module.exports = new Class
({
Extends: Htk.Field
,Tag: 'htk-entry'
2016-10-16 14:16:08 +00:00
,render: function ()
{
2016-10-16 14:16:08 +00:00
var node = this.createRoot ('input');
node.type = 'text';
node.addEventListener ('change', this._onChange.bind (this));
}
,_onChange: function (event)
{
var newValue;
if (this.node.value == '')
newValue = null;
else
newValue = this.node.value;
this.valueChanged (newValue);
}
,putValue: function (value)
{
if (!value)
this.node.value = '';
else
this.node.value = value;
}
,setEditable: function (editable)
{
this.node.readOnly = !editable;
}
});