Headercolor with onRender

Questions and answers for designing and implementing forms in Servoy

Headercolor with onRender

Postby jos@devoon.nl » Wed Jan 25, 2012 12:33 pm

While converting our main solution to version six (Servoy 6.0.4) I bumped into this:
We have a form in Table View (locked) with a Header portion. On this part a label is placed with a special backround color and some labels with custom texts.
However, with the new onRender function this color is overuled by the isRecordSelected() color.
The LABEL element is detected as a record but the data that belong to it come from the selected record (This goes for ALL labels on the form.) So when the functions asks for the event.isRecordSelected() it will be true while the event element is a label. Unfortunately I can not extract this property from the JSRenderEvent object to correct the output of the function.
Anyone knows a solution for this?
Is this a bug?
Jos Uitenbogaard
Devoon
User avatar
jos@devoon.nl
 
Posts: 60
Joined: Tue Oct 25, 2011 11:59 am
Location: Reeuwijk NL

Re: Headercolor with onRender

Postby jasantana » Wed Jan 25, 2012 1:45 pm

Hi Jos.

Do not use the onRender() event of the form but the onRender() event in each field you want to change the color, of course pointing to the same function.

That works for me.
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: Headercolor with onRender

Postby jos@devoon.nl » Wed Jan 25, 2012 2:36 pm

Rendering each individual field is (in this case) too complicated. I just want bgcoloring for a whole record. What I do now is call the getRenderable() function that returns the object to render. From this I can ask for the getElementType() or/and getName (I have to 'name' some elements explicitly).
By doing so I can check if the object is the right element to render in the right color.
Jos Uitenbogaard
Devoon
User avatar
jos@devoon.nl
 
Posts: 60
Joined: Tue Oct 25, 2011 11:59 am
Location: Reeuwijk NL

Re: Headercolor with onRender

Postby Gabi Boros » Thu Jan 26, 2012 1:04 pm

please create a case for this in our support system http://www.servoy.com/s
Gabi Boros
Servoy
Gabi Boros
 
Posts: 402
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: Headercolor with onRender

Postby Jan Blok » Tue Mar 13, 2012 2:18 pm

Thanks for filing a support case, but we cannot alter this behaviour.
The selected record is always used outside the body part as datasource for any element, so we cannot start saying the record is not selected during onRender for elements in a not body part.
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam


Return to Forms

Who is online

Users browsing this forum: No registered users and 11 guests

cron