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
Untitled.png (98.68 KiB) Viewed 2619 times
ellen escarcega (formerly meserow)
meserow design
Servoy 2019 9
MSSQL 2017
Windows AWS Servers
ellenmeserow
 
Posts: 366
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
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests

cron