Page 1 of 1

onRender()

PostPosted: Fri Mar 06, 2020 5:25 pm
by lwjwillemsen
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.

Re: onRender()

PostPosted: Sat Mar 07, 2020 10:36 am
by Joas
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.

Re: onRender()

PostPosted: Sat Mar 07, 2020 4:39 pm
by lwjwillemsen
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,

Re: onRender()

PostPosted: Sun Mar 08, 2020 3:02 pm
by jcompagner
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

Re: onRender()

PostPosted: Mon Mar 09, 2020 4:19 pm
by lwjwillemsen
Okay, can this be styled then in Smart- and NG-client?