Alternative
Hi Alex,
In the previous version i used to use this for
changing the bgColor of column
obj.getColumnTemplate(2).setStyle("background-color", myColor);
How can i do it under this release ?
Vipin
October 6,
With v2.0
script:
obj.getCellTemplate(1).setStyle("background-color", "#ccc");
css:
.aw-column-1 {background: #ccc;}
Alex (ActiveWidgets)
October 6,
Hi Alex,
thanx for da reply
I figured out that much but the problem i am getting that i wanna set color using the "text" of the cell.
so i called
obj.getCellTemplate(1).setStyle("background-color", myColor);
in myColor method i was extracting value using
var value =this.getItemProperty("text");
this is no longer working.... so i was actually soughting the alternative of this.
Vipin
October 7,
is there any way to get the cell text ?
Vipin
October 10,
Yes, you can retrieve current cell text (while inside template) with the folowing call:
var text = this.getControlProperty("text");
Here is more generic code which allows you to get data from other columns as well:
var obj = new AW.UI.Grid;
obj.setCellText(function(col, row){return col + "." + row});
obj.setColumnCount(10);
obj.setRowCount(10);
obj.defineCellProperty("color", function(col, row){
var text = this.getCellText(col, row);
return text.match(/[234]/) ? "red" : "white";
});
obj.getCellTemplate(1).setStyle("background-color", function(){
return this.getControlProperty("color");
});
document.write(obj);
Alex (ActiveWidgets)
October 10,