# Servoy 7 onRender

**URL:** <https://forum.servoy.com/t/servoy-7-onrender/18585>\
**Category:** Classic Servoy\
**Created:** [October 6, 2015, 7:30pm UTC](https://forum.servoy.com/t/servoy-7-onrender/18585 "2015-10-06T19:30:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellenmeserow](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ellenmeserow](https://forum.servoy.com/u/ellenmeserow)\
**Post date:** [October 6, 2015, 7:30pm UTC](https://forum.servoy.com/t/servoy-7-onrender/18585/1 "2015-10-06T19:30:44Z")

</div>

Having so much trouble with Servoy 6 (printing, size of dialogs) I have jumped to Servoy 7.4.4 where the former problems are corrected. Spent a lot of time changing over from rowBackgroundCalculation to onRender to get ready for this, and now all of my onRenders are changing foreground colors when they are explictly set to change bgcolor (and do change bgcolor in Servoy 6). Help?:

```auto
if (event.isRecordSelected()) {
		event.getRenderable().bgcolor = '#00ff00';
	} else if (event.getRecordIndex() % 2) {
		event.getRenderable().bgcolor = '#ff0000';
	}

```

[attachment=0]Untitled.png[/attachment]

 ![Untitled.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/1X/ee54f0e46d0ac8425af867b05cba2443bfaf72d3.png)

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [October 7, 2015, 7:11am UTC](https://forum.servoy.com/t/servoy-7-onrender/18585/2 "2015-10-07T07:11:37Z")

</div>

It looks like your fields are set to **transparent**.

Having said that, a better approach to do row coloring is by using styles. Just add this to your style sheet:

```auto
odd {
	background-color: #ffffff;
}

even {
	background-color: #ff0000;
}

selected {
	background-color: #00ff00;
}

```

This will be more efficient, because the onRender method will be called for every cell on your form.
