:: Forum >>

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

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

css:

.aw-column-1 {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(col, row){return col + "." + row});
    obj.setColumnCount(10);
    obj.setRowCount(10);

    // add new cell property
    obj.defineCellProperty("color", function(col, row){
        var text = this.getCellText(col, row);
        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 support forum

Forum search