onRender()

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

onRender()

Postby lwjwillemsen » Fri Mar 06, 2020 5:25 pm

Hi,

How can I check the read only state of a column in table view form in the onRender() event handler starting with the event parameter?

I am converting onRowBGCalculation() to onRender().
Oh, I am using the onRender()-event on form level.
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: onRender()

Postby Joas » Sat Mar 07, 2020 10:36 am

You could do something like this:
Code: Select all
   if (event.getRenderable().getName() && elements[event.getRenderable().getName()].readOnly) {
      event.getRenderable().bgcolor = '#ff0000';
   } else {
      event.getRenderable().bgcolor = '#00ff00';
   }

Always be careful when using onRender, it will be called a lot of times.
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

Re: onRender()

Postby lwjwillemsen » Sat Mar 07, 2020 4:39 pm

Thanks Joas!

I was trying to write a generic onRender() handler outside the form with only the event parameter as parameter.
There is regrettably no handle grip in the JSRenderEvent to the calling form (and form elements) I am aware of.

I think I should use form inheritance probably...

Regards,
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: onRender()

Postby jcompagner » Sun Mar 08, 2020 3:02 pm

please be aware that all this kind of code using onrender will not work for NGClient so it is not something that can be used to move forward
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: onRender()

Postby lwjwillemsen » Mon Mar 09, 2020 4:19 pm

Okay, can this be styled then in Smart- and NG-client?
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 9 guests