:: Forum >>

oncellvalidated and background color

i am using this code to change the background color of the row when a cell edit is detected. The problem is that even though the row color is updated, the entire grid freezes. i'm still on v2 rc1.

grid2.onCellValidated = function(text, col, row){
try {
var template = this.getRowTemplate(row);
template.setStyle("background-color", "orange");
template.refresh();
} catch(e) {alert(e) }
}
Michael L
Sunday, February 12, 2006
i keep answering my own questions - bad.

grid2.onCellValidating = function(text, col, row){
    try {
        var template = this.getRowTemplate(row);
        
        // this doesn't do anything but will retain the color change
        // if the control gets deactivated
        template.setStyle("background-color", "orange");
        
        // this is the line that actually changes the row color for me
        template.element().style.backgroundColor = "orange";
    } catch(e) {alert(e) }
}
Michael L
Sunday, February 12, 2006
Michael,

there is currently (2.0) a bug in setStyle() method - if the style name contains "-" symbol it will not be immediately updated on screen. Your code would work fine if you use "background" instead of "background-color".

obj.onCellValidated = function(text, col, row){
    var template = this.getRowTemplate(row);

    //does not work due to the setStyle bug
    //template.setStyle("background-color", "orange");

    // works
    template.setStyle("background", "orange");
}
Alex (ActiveWidgets)
Monday, February 13, 2006
Thanks alex that worked.

I hope you can help me answer this question, does the grid support multiple cell selections? (not rows) - i need to be able to select a range of cells. If not is there a work around?
Michael L
Monday, February 13, 2006
Well, and how to set the background image ? What parameter to pass ?

for example:

group.setStyle("background-image", "../AW/styles/aqua/bg1.png");

does not work...

Best Regards
ASJ
Friday, April 28, 2006
I believe it is like this:

template.setStyle("background", "url(../AW/styles/aqua/bg1.png)");

John Mason
Wednesday, December 6, 2006
I used this technique to change cell background when the color changed. The problem was that the selected cell highlighting stopped working (the white text worked, but the blue background failed). I found this other message with the solution:

Readd these styles with !important

.aw-cells-selected, .aw-rows-selected {
color: #fff!important;
background: #396FA2!important;
}

.aw-rows-selected .aw-grid-cell {
background: none!important;
}

I found the solution in this message from ASJ:

http://www.activewidgets.com/javascript.forum.13601.1/setting-backgroud-color-for-row.html

PeteR
Monday, July 2, 2007

This topic is archived.


Back to support forum

Forum search