3.2.0

Problem with Image according with cell value

Hi, i want to put an image in a cell according to it's value. If the value of the cell is lower than 40 it displays a Green Image, between 40 and 70 a Yellow Image and greater than 90 a red image. I made this code but when i run it in IE it doesn't do it the right way, it shows the images, but not according to the rules.(ie. Cell with value 3 with a red image). I really need to solve this, so i would deeply appreciate any help from any of you Grid Gurus!!! :D thanks!!

<script>
var obj = new AW.UI.Grid;
//I use this to fill the Grid with random values from 1 to 100
obj.setCellData( function(col, row){return Math.floor(Math.random()*100)} );
obj.setHeaderText("header");
obj.setColumnCount(3);
obj.setRowCount(5);
function image(col, row)
{
var valor = this.getCellText(0, row);
if ( valor < "40")
{
return "ImgGreen";
}
else if ( (valor >= "40") && (valor <= "70") )
{
return "ImgYellow";
}
else
{
return "ImgRed";
}
}
obj.setCellTemplate(new AW.Templates.ImageText,0);
obj.setCellImage(image, 0);
document.write(obj);
</script>
Rauldinho
February 20,

This topic is archived.

See also:


Back to support forum