Painting cells in javascript

Hi,

I need to paint an entire row with one specific color (i.e. “LightSkyBlue”), but I don’t know how to specify what cell I want to paint, just the current selected.

Now I can paint that cell with source.orgBgColor = “LightSkyBlue”, but I need to paint not only this cell, but all from the same row.

Here is one example:

If I click the cell B3 (colum = 1, row = 2), I have to paint the background of all the cells from the same row (2).

Remember that it must be done “CLIENT SIDE (Javascript)”.

Hi,

May the following javascript code helps you for your need:

var row = GridWeb1.getActiveRow();
var cell=null;
for(var i=0;i<10;i++)
{
cell = GridWeb1.getCell(row, i);
cell.style.backgroundColor = "LightSkyBlue";

}
Thank you.

Thanks, it will help, but there is a way to know the last column of the current worksheet in Javascript? So I can put this value in the loop.

I used this function to paint a line, based on 2 parameters: row to be painted and color (from 0 to 3):

function pintalinha(row, cor)
{
var color = "";
switch (color)
{
case 1:
color="Khaki";
break;
case 2:
color="LightSkyBlue";
break;
case 3:
color="Red";
break;
default:
color="White";
}
var colmax = validacao[0][0]; // retrieve the number of columns from this grid (there is other way to know?)
var cell = null;
for (var col=0; col <= colmax; col++)
{
cell = GridWeb1.getCell(row,col); // GridWeb1 is my "main grid", where I edit the data.
cell.style.backgroundColor = color;
}
GWTemp.setCellValue(row,0,cor); // GWTemp is my "flag grid", where I store the value received in this function.
}