servoy_row_bgcolor in form views, 2.0RC11

Hi, I’m using

servoy_row_bgcolor

and it works brilliantly in list views, but when I go to the next record in form views the background colour changes too! I would expect it to stay the same in form views…

What is the best workaround?

I haven’t tested this but you can do a check on the view. So I would try something like

So you could do something like:

var recordIndex = arguments[0];
var selected = arguments[1]; 
if (currentcontroller.view != 1)
{
	if (selected)
		return '#ccccff';
	else 
	{
		if (recordIndex % 2 == 0)
			return '#ffffff';
		else
			return '#efefef';
	}
}
else
	return '#ffffff'; //or whatever you want

Or whatever but this should help you on your way.

The only thing that can mess this up is the fact that currentcontroller gives you your base form so any form in a tab won’t be handled ‘properly’ with this method. There is no way to check the formname (yet :) Servoy?)

The only thing that can mess this up is the fact that currentcontroller gives you your base form so any form in a tab won’t be handled ‘properly’ with this method. There is no way to check the formname (yet Servoy?)

it won’t help you in this situation. Because this is a calculation. And you shouldn’t use currentcontroller in the calculation either…
It wil work but is not supported.!! Be very carefull what you do, for example never do: currentcontroller.recordIndex++ in a calculation!!

for checking what form did trigger a method we will have this:

application.getMethodTriggerFormName()

in RC12

window.jar (181 KB)