Color coding text value in an onChangeCell client event?

I know that I can use a Server onAfterGet method to set the css property to change the color of cell text or cell background color in a relationship grid. But I would like to immediately highlight a data entry error that fails validation by highlighting the cell in a different color (red text, for example). I would rather not pop up an alert..

I have set up an onChangeCell client (JavaScript) event on the property, and tried using this code:

var val = gridApplet.GetCellValue(relationshipID, colNumber);
if (val < 0) {
gridApplet.SetCellTextColor(relationshipID, colNumber, "#FF0000");
}

But the SetCellTextColor call triggers a Dojo error, with details like: dojo.data.ItemFileWriteStore: Invalid item argument.

Any suggestions to allow this to work?

Thanks!

Stuart

  • Not sure if you can relationshipID to specify the target row. For quick and dirty testing, will this one color anything?

    var rowId = gridApplet.getSelectedId();
    gridApplet.SetCellTextColor(rowId , colNumber, "#FF0000");

    Well, probably relationshipID is the same then getSelectedId, so it will probably not work. 

    Haven´t seen a lot samples regarding this one. How do you call your gridApplet?