Servoy 8 and onRender()

I recently upgraded from Servoy 7 to Servoy 8.0.3. My application runs fine in developer, but when I upload it to the server and access through the Smart Client, it is painfully slow when switching between records in a table. I finally narrowed this down to being related to the onRender function. Removing the onRender makes everything operate fast again.

I have a form in Table View (locked) with 3 fields, all of which have the following onRender function:

function onRender(event) {
	// TODO Auto-generated method stub
	// NOTE: a property set on the renderable, will be kept on the element only during onRender
	if (event.isRecordSelected()) {
		event.getRenderable().bgcolor = '#0078c1';
		event.getRenderable().fgcolor = '#FFFFFF';
		
	} else if (event.getRecordIndex() % 2) {
		event.getRenderable().bgcolor = '#E6E6E6';	
	}
	

}

This has been working fine for a few years in Servoy 7 and previous versions. Any thoughts?

You should be able to do the same thing with CSS. try removing the onRender, and using this CSS:

odd, even, selected {
	background-color: #FFFFFF;
	color: #000000;
}
odd {
	background-color: #E6E6E6;
}
selected {
	background-color: #0078c1;
	color: #FFFFFF;
}

Which servoy 7 version are we talking about here?

Because the latest servoy 7 or the latest 8 shouldn’t be that much difference (if there is a difference at all) for the smartclients with tableview/onrender

Its also very weird that only on the server is affected and not in developer, this can be if there was database access in the onreder method but that doesn’t seem to be the case

If you have an example that demonstrates this please make a case.

can you add an application.output with event.getRecordIndex() so you can track which cells/rows are rendered during record switching ?
is it different if you navigate on the records with keys vs mouse ?

sorry to bring up an old post but I’m still having the issue. I removed background row coloring and now use CSS for that, which works great. There are still some places where I need to use onRender in Table View to change the color of a field to show a past due date in Red, for example. The onRender function slows down scrolling through records or clicking between. The following onRender function is only set for the one element on my form that needs it.

var record = event.getRecord()
var dateDue = record.due_date
	if (record)
	{	
		var today = new Date();
		if (dateDue < today)
		{
			event.getRenderable().fgcolor = '#DF0101';
		}
		if (dateDue >= today)
		{
			event.getRenderable().fgcolor = '#111111';
		}
	}

Adding application.output(event.getRecordIndex()) to the function reveals that if I mouse click from row 1 to row 5, I see:
5
1
2
3
4
5

If I use the down arrow from row 1 to 2 I see:
2
1
2

Clicking the scroll button once:
2
3
4
5
6
7
8
9
10
11
12
13
14
15

I’m not sure if these are normal or not. Any other ideas? I’m using 8.0.3.

thanks!

is it smart or web client ? if it is smart, the call order of onrender may not match the row orders, it dependents when swing wants to paint the component