Our users are complaining that adding records to the system is very slow (press new line and one is produced about 40 seconds later). I suspect the onRender is the cause, as when I turn the profiler on, it shows the onRender method being triggered hundreds of times (360 at most recent count). I am looking at a foundset of 6 records…
Am I doing the onRender correctly (it doesn’t make a difference whether I use the .bgcolor = myrelation, or .bgcolor = ‘#somecolour’)? Why would there be so many onRenders?
Hi Bevil,
I think I had a similar issue & from what I can remember, your issue might be to do with you using the
contacts_to_superuser
relationship
I think you should be accessing it as
_rec.contacts_to_superuser.colour_selected
assuming that the onRender is happening in the contacts table
onRender if you have it attached to a form will fire for EACH element on your form, so if you have a complex form it will fire a lot.
You can just have specific onRender events only for the elements you actually want to do something on
With regard to bg row colour, can you use CSS style sheet which is recommended way??
I thought that might be the case (after the Wiki says to not use any external code) so I tried a var get_superuser_colour_1 _2 _3 etc. at the beginning of the method, and replaced the relations within the onrender with my vars. No difference…
onRender is evil. Don’t use if for tables generally and never for tables in web client. Use css for row coloring and change the style sheet at runtime for your SaaS preferences.
I would say that a onRowRender() event is badly needed in table view mode…
Fired after all column onRender() events (if present) of the row have been fired.
This is linked to my same problem in the other thread. I thought it was onRender. I am not so sure now. The reason I suspected onRender was because the profiler in Servoy developer shows hundreds (360) onrender events when I add a line - however this mostly slows it down when the profiler is running, and the 360 is logged for each of the elements on the form.
My remaining issue with onRender, for which there seems to be nothing on the forum, is whether there is a way to get it to only render the bgcolor of the form element / body background. I don’t want to render all 360 elements (do I have to?) and also I don’t want to change the colour of some elements (a combobox for example also changes colour when my onRender is triggered.)
In short, the issue I thought with onRender seems to be part of a bigger issue, and onRender is possibly not the culprit.