47 lines
760 B
JavaScript
47 lines
760 B
JavaScript
|
Htk.ColumnButton = new Class
|
||
|
({
|
||
|
Extends: Htk.Column
|
||
|
,Tag: 'htk-column-button'
|
||
|
,Properties:
|
||
|
{
|
||
|
image:
|
||
|
{
|
||
|
type: String
|
||
|
,value: null
|
||
|
},
|
||
|
tip:
|
||
|
{
|
||
|
type: String
|
||
|
,value: null
|
||
|
}
|
||
|
}
|
||
|
|
||
|
,render: function (tr)
|
||
|
{
|
||
|
var td = this.parent (tr);
|
||
|
|
||
|
var button = document.createElement ('button');
|
||
|
button.className = 'cell-button';
|
||
|
button.addEventListener ('click',
|
||
|
this.buttonClicked.bind (this, this.value, tr));
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
,buttonClicked: function (value, tr)
|
||
|
{
|
||
|
this.signalEmit ('clicked', value, tr.rowIndex - 1);
|
||
|
}
|
||
|
});
|