3.2.0

alternative row color depend of cell value? help for beginer

how can i change row color depende of cell value?i`m using v2.0 rc1
thanks
my regards
japi
February 17,
Please,

I'm using the v.2.0 and I would like change the background of my row with one value how is in position of my array, How I can do it ?

In the last version I can this after down, but in this version 2.0 don't have suport to the object.
------------------------------------------------------------------
$html .= "try {\n";
$html .= " var obj = new Active.Controls.Grid;\n";
$html .= " obj.setDataText(function(i, j){ vCorAtual=obj_data[i][j+1]; return obj_data[i][j]; });\n";
$html .= " var alternate = function(){ return vCorAtual; }\n ";
$html .= " var rowLocal = new Active.Templates.Row;\n ";
$html .= " rowLocal.setStyle(\"background\", alternate);\n";
$html .= " obj.setTemplate(\"row\", rowLocal);\n";
$html .= " obj.setColumnTemplate(new Active.Templates.Image, 0);\n";
$html .= " obj.setRowCount($row_count);\n";
$html .= " obj.setColumnCount($column_count);\n";
$html .= " obj.setEvent(\"ondblclick\",function(){link_go(\"".$url."\" ,obj.getSelectionProperty(\"index\")) } );";
$html .= ' obj.setStyle("border", "2px solid #999");';
$html .= ' obj.setStyle("width", "98%");';
$html .= ' obj.setStyle("height", "40%");';
$html .= " obj.setDataProperty(\"image\", function(i,j){ return obj_data[i][".($column_count+2)."] });\n";
$html .= " obj.setColumnHeaderHeight(25);\n";
$html .= " obj.setRowHeaderWidth(\"0\");\n";
$html .= " obj.setDataText(function(i, j){ vCorAtual=obj_data[i][j+1]; return obj_data[i][j]; });\n";
$html .= " obj.setColumnText(function(i){ return obj_columns[i]});\n";
$html .= " obj.setColumnText(function(i){return obj_columns[i]});\n";
$html .= " document.write(obj);\n";
$html .= "}\n";
$html .= "catch (error){\n";
$html .= " document.write(error.description);\n";
$html .= "}\n";

------------------------------------------------------------------

Thank's !

Felipe
felipe.cardoso.martins@gmail.com
+55 11 8573.6968
Felipe
June 8,
Here is an example -

var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText(function(i){return "Col " + i});
obj.setColumnCount(10);
obj.setRowCount(100);

// create new row property
obj.defineRowProperty("color", function(row){
    return this.getCellData(0, row).match("1") ? "red" : "white";
})

// link row background to row color property
obj.getRowTemplate().setStyle("background", function(){
    return this.getRowProperty("color");
});
Alex (ActiveWidgets)
June 8,
Thank's Alex !
Felipe
June 8,

This topic is archived.

See also:


Back to support forum