:: Forum >>

Is there an equivalent to an "onCellLoad()" event for grid?

I apologize if this has been addressed, and I'm sure it has, however I've been wading through the forum for over an hour.

I'm want to test a cell value upon initial load (or setting of that cell value) and set the cell image based on that. I can do easily with the onCellValidated (et. al.). If not, what is the most efficient way to accomplish this? It would be great to just re-use this block rather than doing a loop through all the values. Here's my cell changed sample:

obj.onCellValidated = function(text, col, row){

// Yes, I know I can simply lower-case the text and set the
// css in one pass ...
if( col==3 ) {
switch(text) {
case "Complete":

case "Incomplete":

case "Waived":
obj.setCellImage("waived",col,row); break;
default: break;

Thanks in advance.
Curt K. :: California
Thursday, April 2, 2009
It sounds like you probably want to modify the cell template. Have a look at http://www.activewidgets.com/aw.templates.cell/ and look at this forum topic http://www.activewidgets.com/javascript.forum.24619.5/setting-cell-colour-start-cell.html

That changes the cell style. Shouldn't be too hard to tailor it to modify the contents instead.
Thursday, April 2, 2009
Thanks Anthony,

I have included a scaled-down sample. Perhaps you could correct/enhance the last part?

.aw-image-complete {
background-image: url(images/ok.png);
background-repeat: no-repeat;
.aw-image-waived {
background-image: url(images/hand.png);
background-repeat: no-repeat;
.aw-image-incomplete {
background-image: url(images/flag_red.png);
background-repeat: no-repeat;

grid.defineCellProperty("status-icon", function(col, row){
var text = this.getCellText(col, row);
return text.toLowerCase();

// assign background-color property to column-1 background
grid.getCellTemplate(3).setStyle("status-icon", function(){
return this.getControlProperty("status-icon");

// Something like this ...
cell.whenCellContentsChange(function(text,col,row) {

Curt K. :: California
Friday, April 3, 2009

look at the sample code in /examples/images-using/grid cells.htm

Here is the statement which assigns the images -

grid.setCellImage(function(col, row){return myData[row][4]});

You can just put your switch statement inside this function and use getCellText(col, row) to retrieve the text value.
Alex (ActiveWidgets)
Friday, April 3, 2009
Thank you Alex, that works for me.
Curt K. :: California
Friday, April 3, 2009

This topic is archived.

Back to support forum

Forum search