Pergunta

iam tentando estilo de uma linha dentro de um dojox (1.2.3) Grade dependendo dos valores da rede.

GridLayout:

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

getColor Função:

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

E eu não tenho nenhuma idéia de como obter o valor TASK_ID de cada linha e definir um estilo para a linha .. se alguém tem uma ligação boa ou sabe como fazer .. que seria ótimo.

Foi útil?

Solução

Got-lo por mim mesmo:

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);


                });
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top