3.2.0

Text in the first column based on numeric cell value

Hi,

I use setSelectorText to add text or image to the first column on a grid, but this text or image must be different if the value on the cell is more or equal to 1

For example, can you tell me how to put the number 2 on the first column if the value on a cell in the second row is more or equal to 1

(I am also trying to change the background color to red .."if the value on a cell in the second row is more or equal to 1")

I am using the code below. Any idea?
-------------------------
<script>
var myHeaders = ["Test","Test2","Test3"];
var myCells = [
["Temp","14","On"],
["Temp","0","On"],
["Temp","1","On"],
["Temp","5","Off"],
["Temp","5","Off"] ];

var obj = new AW.UI.Grid;
obj.setHeaderText(myHeaders);
obj.setCellText(myCells);

obj.setSelectorVisible(true);
obj.setSelectorWidth(15);

obj.setSelectorText("1");

obj.setColumnCount(myHeaders.length);
obj.setRowCount(myCells.length);
document.write(obj);
</script>
-------------------------
Angel
July 4,
I am using the line below the set the background color

obj.getCellTemplate(column, row).setStyle("background", "red");

but my problem is that the page is in php (data from sql) so I can't see the data before the page is loaded in a browser.

May be using the obj.getCellValue command to get the cell data but I'm not an expert in javascript :-(
Angel
July 5,

This topic is archived.

See also:


Back to support forum