:: Forum >> Version 2 >>

changing cell color + cell selection color

Hi

I'm working on a grid that has cells with different colors. I'm doing it in the following way:
obj.getCellTemplate(i, j).setStyle("background-color", "#FFA500!important")

But when I select a cell that have the color changed, it doesn't get highlighted. The cells that I don't chnage the color are highlighted normally.

Is there anyway to do it work? I try to put some code inside the fucntion calculateCellState to alter the background-color, but it didn't work ...

By the way, I'm working in an alternate selection mode where it is possible to select multiple cells. If anybody is interested, I can send the parts of the code that I've changed.

Bye!
RGB
Roberto Barra
Thursday, February 2, 2006
Ok, I find a way to make it work ... it's not pretty, but it works.

I changed the function selectCell(c, r) in the follwoing way:



var colorBgB document.getElementById(
        
this.getCellTemplate(
            
this.getCurrentColumn(), 
            
this.getCurrentRow()).getId()).title;
document.getElementById(
    
this.getCellTemplate(
        
this.getCurrentColumn(), 
        
this.getCurrentRow()).getId()).style.backgroundColor colorBgB;

this.setCurrentColumn(c);
this.setCurrentRow(r);
this.setSelectedColumns([c]);
this.setSelectedRows([r]);

for (
0selCells.length2)
{
   var 
cTmp selCells[i];
var 
rTmp selCells[1];
   if (
this.getCellSelected(cTmprTmp))
   {
      
this.setCellSelected(falsecTmprTmp);
      var 
colorBg document.getElementById(obj.getCellTemplate(cTmprTmp).getId()).title;
      
document.getElementById(obj.getCellTemplate(cTmprTmp).getId()).style.backgroundColor colorBg;
   }
}
selCells = new Array();

var 
colorBg document.getElementById(obj.getCellTemplate(cr).getId()).style.backgroundColor;
document.getElementById(obj.getCellTemplate(cr).getId()).title colorBg;
document.getElementById(obj.getCellTemplate(cr).getId()).style.backgroundColor '#122334';

 
I saved the value of the old color of the cell in the title attribute. I don't think it'll be used for some ohter thing.

selCells must be declared somewhere.

That's it.
RGB
Roberto Barra
Thursday, February 2, 2006



This topic is archived.

Back to support forum

Forum search