Question

iam essayant de styler une ligne dans une grille DojoX (1.2.3) en fonction des valeurs de la grille.

GridLayout:

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

Fonction getColor:

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

Et je ne sais pas comment obtenir la valeur task_id de chaque ligne et définir un style pour la rangée .. si quelqu'un a un bon lien ou sait comment faire .. ce serait génial.

Était-ce utile?

La solution

Je l'ai moi-même:

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


                });
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top