Is there a way we can hightlight the current record when it’s selected? (see attached pic)
It would be a nice to have such a property for the forms (in list view). Currently servoy highlights the current record in the table view. But it would be nice to have similar and also ability to use any color in the list view
A listview shows the current record selection if the vertical lines property is enabled, and current editing record is highlighted in tableview when selected.
Highlighting is handeled by the (OS) Look And Feel… is not in our control
What we could do is make the listview/tableview/portal look for a calculation called “servoy_row_bgcolor” and if present is called with recordIndex and selected flag.
In which case you could make the servoy_row_bgcolor calc like:
var recordIndex = arguments[0]
var selected = arguments[1];
if (selected)
{
return '#CCCCEE';
}
else
{
if (recordIndex % 2 == 0)//alternate on even oneven
{
return '#0000FF';
}
else
{
return '#FF0000';
}
}
Jan Blok:
What we could do is make the listview/tableview/portal look for a calculation called “servoy_row_bgcolor” and if present is called with recordIndex and selected flag.
In which case you could make the servoy_row_bgcolor calc like:
var recordIndex = arguments[0]
var selected = arguments[1];
if (selected)
{
return ‘#CCCCEE’;
}
else
{
if (recordIndex % 2 == 0)//alternate on even oneven
{
return ‘#0000FF’;
}
else
{
return ‘#FF0000’;
}
}
Let me know your ideas.
Yes, please, anything that makes Servoy NOT look like FileMaker with the stupid little black box at left as the record indicator. I like the flexibility of being able to specify every other, every three or every n records.
Although it would be preferable if the highlight was just a propery of a form in list view. Being able to set the alternating would be nice as a property as well. Imagine the following…
Property whould be possible but, if you want to mark a specific records because it holds very important information you could do so with my proposed method and not with a form property…
var index = arguments[0]
var selected = arguments[1];
if (myimportantData == 1)
{
return '#FF0000' //mark red, is overruling the selected also!
}
else
{
if (selected)
{
return '#CCCCEE';
}
else
{
if (index % 2 == 0)//alternate on even oneven
{
return '#0000FF';
}
else
{
return '#00FF00';
}
}
}
Well yes, both is possible, but we prefer to build one and save some resources for other things which are on the planning.
Since the calculation suggestion is the most powerfull, we prefer that one.