what value does this.getItemProperty("value"); return is it String? then why the following code doesnot change the text color for "knm"

<title>ActiveWidgets Grid :: Examples</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;} </style>

<!-- ActiveWidgets stylesheet and scripts -->
<link rel="stylesheet" type="text/css" href="../css/dropdown_menu.css" />
<link href="grid/grid.css" rel="stylesheet" type="text/css"></link>
<script src="grid/grid.js"></script>

<!-- grid format -->
.active-controls-grid {height: 100%; font: menu;}

.active-column-0 {width: 80px;}
.active-column-1 {width: 200px; background-color: threedlightshadow;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}

.active-grid-column {border-right: 1px solid threedshadow;}
.active-grid-row {border-bottom: 1px solid threedlightshadow;}

<!-- grid data -->
var myData = [
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420", "28961"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000", "16000"],
["KNM", "Konami Corporation (ADR)", "3,710.784", ".000", "4313"]

var myColumns = [
"Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"

// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;

// set number of rows/columns
obj.setRowProperty("count", 3);
obj.setColumnProperty("count", 5);

// provide cells and headers text
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});

// set headers width/height

// set click action handler
//obj.setAction("click", function(src){window.status = src.getItemProperty("text")});

function myColor(){
var value = "";
value = this.getItemProperty("value");
// alert(value);
//var value1 = String(value);
return value == 'knm' ? "red" : "green";

obj.getColumnTemplate(0).setStyle("color", myColor);

// write grid html to the page

July 13,
Just because, you need a line like this to fill grid-values:
obj.setDataProperty("value", function(i, j){return myData[i][j]});

And also because values are case-sensitive, i.e.
return value == 'KNM' ? "red" : "green";

Note ' This is a version 1.0.x mistakenly posted in the version 2.x thread section'
July 13,
value = this.getItemProperty("value");
Replace "value" with "text" .u can now compare strings.

Note ' This is a version 1.0.x mistakenly posted in the version 2.x thread section'

July 13,

This topic is archived.

See also:

Back to support forum