开发者

How to change font color of a dojo DataGrid row after a cell has been edited

开发者 https://www.devze.com 2023-03-24 12:15 出处:网络
I want to change the font color of a row开发者_StackOverflow中文版 after a cell in that row has been edited and set to a certain value.

I want to change the font color of a row开发者_StackOverflow中文版 after a cell in that row has been edited and set to a certain value. myStore is the dojo.data.ItemFileWriteStore associated to the dojox.grid.DataGrid dataGrid.

I have written this:

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

but unfortunately this doesn't make any effect...

UPDATE: I added the following style property: "backgroundColor" : "red". Well, the background color of the row changes to red, but when the mouse moves away from the row, the color changes back to the default! It might be that some default event handlers restore the default styles...


The dojo.style line works if you call it by itself. Either your function isn't being called at all, the if's condition false or there is no row selected and you are getting an invalid number for the index. (You can put some console.logs there to check)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号