0

I've just read this post: Colorize the CRM grid.

I'm trying to do something similar but I want to be able to change just the font colour of a column called Status Reason.

Will it be possible to modify this code to do this and if yes would someone please be able to point me in the right direction.

I will warn you at the outset that I've only been playing with Javascript and CRM customization for about 2 weeks now!

Thanks!

Community
  • 1
  • 1

1 Answers1

0

Yes it would be possible to modify the code to do that.

If you read the code through, you will see that the "styling" is done near the bottom:

if (new_date_value <= current_datetime) {
    InnerGrid.rows[i].style.backgroundColor="ff0066";
} else {
    InnerGrid.rows[i].style.backgroundColor="ff6600";
}

So your styling changes would just slot in there.

You will also notice that this bit of code is applying style to the entire row (InnerGrid.rows[i]...) whereas you only want to apply it to a specific column within that row, so you would address InnerGrid.rows[i].cells[colorizeColumn].style... instead (assuming you will just change the column that is triggering the formatting.

That should be enough to get you going.

Greg Owens
  • 3,878
  • 1
  • 18
  • 42
  • Here's what I've got so far: `var colorizeColumn = InnerGrid.FindColumnIndex("statuscode"); if (colorizeColumn > 0) { for (var i = 0; i < InnerGrid.AllRecords.length; i++) { if (InnerGrid.rows[i].cells[3].innerText == "To Be Closed") { InnerGrid.rows[i].cells[3].style.backgroundColor="ff0000"; } } }` This doesn't seem to work but I'm assuming that's because I'm not referencing the column that I want to change correctly. Any tips? P.S: Apologies for the formatting, I can't seem to insert line breaks for some reason! – user1480631 Jun 27 '12 at 10:03