我试图根据网格中的值在DojoX(1.2.3)网格中设置一个Row样式。

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值并为其设置样式 排...如果有人有一个很好的链接或知道怎么做..这将是伟大的。

有帮助吗?

解决方案

我的自己:

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


                });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top