2009-11-30 24 views
6

iam intentando diseñar una fila dentro de un DojoX (1.2.3) Cuadrícula según los valores de la grilla.Estilo Dojox Grid Fila según los datos

GridLayout:

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

Función getColor:

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

y no tengo ni idea de cómo obtener el valor task_id de cada fila y establecer un estilo de la fila .. si alguien tiene un buen enlace o sabe cómo hacerlo ... sería genial.

Respuesta

10

¡Gracias por mi mismo:

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


       }); 
Cuestiones relacionadas