forked from verdnatura/hedera-web
85 lines
1.2 KiB
JavaScript
Executable File
85 lines
1.2 KiB
JavaScript
Executable File
/**
|
|
* Represents a grid column. This is an abstract class and should not be
|
|
* instantiated directly.
|
|
**/
|
|
Htk.Column = new Class
|
|
({
|
|
Extends: Vn.Object
|
|
,Tag: 'htk-column'
|
|
,Parent: 'grid'
|
|
,Properties:
|
|
{
|
|
value:
|
|
{
|
|
type: Object
|
|
,value: null
|
|
},
|
|
column:
|
|
{
|
|
type: String
|
|
,value: null
|
|
},
|
|
columnIndex:
|
|
{
|
|
type: Number
|
|
,value: -1
|
|
},
|
|
title:
|
|
{
|
|
type: String
|
|
,value: null
|
|
},
|
|
editable:
|
|
{
|
|
type: Boolean
|
|
,value: false
|
|
},
|
|
renderer:
|
|
{
|
|
type: Function
|
|
,value: false
|
|
},
|
|
grid:
|
|
{
|
|
type: Htk.Grid
|
|
,set: function (x)
|
|
{
|
|
if (x)
|
|
x.appendColumn (this);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initializes the column.
|
|
**/
|
|
,initialize: function (props)
|
|
{
|
|
this.parent (props);
|
|
this.td = document.createElement ('td');
|
|
}
|
|
|
|
/**
|
|
* Draws the cell and returns its associated td.
|
|
*
|
|
* @param {HTMLTableRow} tr the table row
|
|
* @return {HTMLTableData} the rendered cell
|
|
**/
|
|
,render: function (tr)
|
|
{
|
|
return this.td.cloneNode (true);
|
|
}
|
|
|
|
,updateColumnIndex: function (model)
|
|
{
|
|
if (this.column)
|
|
this.columnIndex = model.getColumnIndex (this.column);
|
|
}
|
|
|
|
,changed: function (tr, newValue)
|
|
{
|
|
this.signalEmit ('changed', tr.rowIndex - 1, newValue);
|
|
}
|
|
});
|
|
|