Стиль Dojox Grid Row в зависимости от данных - PullRequest
6 голосов
/ 30 ноября 2009

Я пытаюсь стилизовать строку в сетке DojoX (1.2.3) в зависимости от значений из сетки.

GridLayout:

var view1 = {
                noscroll: true,
                rows: [{
                    field: 'TASK_ID',
                    name: 'ID',
                    width: '80px',
                    get: this.getColor
                }, {
                    field: 'MENUPOINT',
                    name: 'Action',
                    width: '250px'
                }]
            };

Функция getColor:

 getColor: function(inRowIndex) {
        console.log(inRowIndex);
        grid = dijit.byId('gridTaskCurrent');
            // if task_id = 1 style row with other background(?)
        },

И я понятия не имею, как получить значение task_id из каждой строки и установить стиль для строка ... если кто-то имеет хорошую ссылку или знает, как это сделать ... это было бы здорово.

1 Ответ

10 голосов
/ 30 ноября 2009

Получил сам:

dojo.connect(dijit.byId('gridTaskCurrent'), 'onStyleRow' , this, function(row) {
                   var item = grid.getItem(row.index);

                    if (item) {
                        var type = grid.store.getValue(item, "LOCKED", null);
                        if (type == 1) {
                            row.customStyles += "background-color:limegreen;";
                        }
                    }

                    grid.focus.styleRow(row);
                    grid.edit.styleRow(row);


                });
...