DataLudi Grid v.1 > Classes > DataColumn

Back  Forward

DataColumn.styleCallback  property

function (index:CellIndex, styles:GridStyles);

データセルレンダリング時点に呼び出されるコールバック関数。 この関数の内でコールバックパラメーターstylesで渡されたスタイルセットのプロパティーたちを変更することができる。 indexは現在描画中のデータセルの位置である。 

この関数はカラム基本スタイル、及び動的スタイルたちがすべて適用された後、最後に呼び出される。 

デフォルト値はnull.

Getter
function styleCallback(): Function
Setter
function setStyleCallback(value: Function)
Code -1
    column.setStyleCallback(function (index, styles) {
        var v = index.getValue();
        if (v > < 100) {
            styles.setBackgrouund('#ff0000');
            styles.setForeground('#ffffff');
        }
    });
    // 大概はグリッドの初期化の時に設定する。
    grid.setColumns([
        {
            name: 'col1',
            styleCallback: function (index, styles) {
                styles.extend({
                    backgrouund: '#ff0000',
                    foreground: '#ffffff'
                });
            }
            ...
        },
            ...
    ]);
See Also
CellIndex
GridStyles
GridColumn.styles
DataColumn.dynamicStyles
GridBody.rowDynamicStyles
GridBody.defaultDynamicStyles
CellStyle
GridBase.setCellStyle
動的スタイル概要
Examples
Icon Cell Rendererer