是否可以以编程方式设置 Datagrid 的选定行的样式?
任何人都可以提供一个片段吗?
试试这个(这是一个修改参考指南示例的小提琴):
var grid = new dojox.grid.DataGrid({
    id: 'grid',
    store: store,
    structure: layout,
    rowSelector: '20px',
    onClick: function() {
        // ( selection.selected is array for multiple)
        var index = this.selection.selectedIndex,
        // typically 1 here, mess with it if nogo on solution
        viewindex = 1,
        RAWROWNODE = this.views.views[viewindex].rowNodes[index]
    }
}, document.createElement('div'));
您还可以查看网格组件使用的样式表。
.dojoxGridRow,
.dojoxGridRowOdd,
.dojoxGridRowSelected {
}
为什么不简单地覆盖正确的 css 类?否则你可能想看看 onStyleRow 和 styleRowState 函数
尝试这个
 dojo.connect(grid, 'onStyleRow', this, function (row) {
    if (grid.selection.selectedIndex == row.index) {
       row.customStyles += "color: red;";            
    }
    grid.focus.styleRow(row);
    grid.edit.styleRow(row);
});