:: Forum >> Version 2 >>

Alternative

More information on this topic is available in the documentation section: /general.faq.releases/.

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
Thursday, October 6, 2005
With v2.0
script:

obj.getCellTemplate(1).setStyle("background-color""#ccc");
 
css:

.aw-column-{background#ccc;}
 
Alex (ActiveWidgets)
Thursday, October 6, 2005
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 calledobj.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
Friday, October 7, 2005
is there any way to get the cell text ?
Vipin
Monday, October 10, 2005
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(colrow){return col "." row});
    
obj.setColumnCount(10);
    
obj.setRowCount(10);

    
// add new cell property
    
obj.defineCellProperty("color", function(colrow){
        var 
text this.getCellText(colrow);
        return 
text.match(/[234]/) "red" "white";
    });

    
// assign color property to column-1 background
    
obj.getCellTemplate(1).setStyle("background-color", function(){
        return 
this.getControlProperty("color");
    });

    
document.write(obj);

 
Alex (ActiveWidgets)
Monday, October 10, 2005
Thanks! :-)
Vipin
Tuesday, October 11, 2005



This topic is archived.

Back to /general.faq.releases/

Documentation:

Forum search