Servoy 7 onRender

Questions and answers for designing and implementing forms in Servoy

Servoy 7 onRender

Postby ellenmeserow » Tue Oct 06, 2015 9:30 pm

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?:

Code: Select all
if (event.isRecordSelected()) {
      event.getRenderable().bgcolor = '#00ff00';
   } else if (event.getRecordIndex() % 2) {
      event.getRenderable().bgcolor = '#ff0000';

Untitled.png (98.68 KiB) Viewed 1296 times
ellen meserow
meserow consulting
Servoy 5.2
MSSQL 2005
Windows 2000/2003 Server
Posts: 358
Joined: Sat Aug 07, 2004 10:18 pm
Location: Seattle, WA USA

Re: Servoy 7 onRender

Postby Joas » Wed Oct 07, 2015 9:11 am

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:

Code: Select all
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.
Joas de Haan
Yield Software Development
User avatar
Site Admin
Posts: 774
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL

Return to Forms

Who is online

Users browsing this forum: No registered users and 8 guests