1

我想在该行中的一个单元格被编辑并设置为某个值后更改该行的字体颜色。myStore 是与 dojox.grid.DataGrid dataGrid 关联的 dojo.data.ItemFileWriteStore。

我写了这个:

myStore.onSet = function(item, attribute, oldValue, newValue) { 
    if (item.myField == myValue) {
        var index = dataGrid.selection.selectedIndex;
        dojo.style(dataGrid.getRowNode(index), "color" , "red");
    }
}

但不幸的是,这没有任何效果......

更新:我添加了以下样式属性:“backgroundColor”:“red”。好吧,该行的背景颜色变为红色,但是当鼠标移开该行时,颜色会变回默认值!可能是某些默认事件处理程序恢复了默认样式...

4

1 回答 1

0

如果您自己调用 dojo.style 行,它就可以工作。要么您的函数根本没有被调用,if 的条件为假,要么没有选择任何行,并且您得到的索引编号无效。(你可以放一些console.logs在那里检查)

于 2011-07-29T23:34:19.540 回答