0
1
Fork 0
hedera-web-mindshore/js/htk/column/button.js

66 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
module.exports = new Class
({
Extends: Htk.Column
,Tag: 'htk-column-button'
,Properties:
{
image:
{
type: String
,value: null
},
2016-09-26 09:28:47 +00:00
icon:
{
type: String
,set: function (x)
{
this._icon = x;
this.image = 'image/icon/light/'+ x + '.svg';
}
,get: function ()
{
return this._icon;
}
},
tip:
{
type: String
,value: null
}
}
,initialize: function (props)
{
this._cssClass = 'cell-button';
this.parent (props);
}
,render: function (tr)
{
var td = this.parent (tr);
var button = document.createElement ('button');
button.addEventListener ('click',
2015-07-07 15:27:47 +00:00
this.buttonClicked.bind (this, this.value, tr, button));
td.appendChild (button);
var img = document.createElement ('img');
img.src = this.image;
button.appendChild (img);
if (this.tip)
{
button.title = _(this.tip);
img.title = _(this.tip);
}
return td;
}
2015-07-07 15:27:47 +00:00
,buttonClicked: function (value, tr, button)
{
2015-07-07 15:27:47 +00:00
this.signalEmit ('clicked', value, tr.rowIndex - 1, button);
}
});