Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on April 15, 2020, 03:50:47 am



Title: Ask Reuben 4 - Change Background Color Of Alternate Rows
Post by: Reuben B. on April 15, 2020, 03:50:47 am
How do you make the background color of rows in a DISPLAY ARRAY + TABLE different colors so that it is easier to read across rows of data?

When viewing data in a DISPLAY ARRAY + TABLE it can be difficult to read across rows and errors may occur if you accidentally skip up or down a row whilst reading from left to right.

Some of you maybe old enough to remember green bar paper (alternatively known as gold bar or zebra paper).  That made it easy to read reports (and code printouts!) as you read across either a white row or a different coloured alternate row, typically green or gold, hence the name green or gold bar.  The alternating bands of color kept your eyes in the same row.

Using Presentation Styles it is possible to do a similar thing in Genero screens.  It makes use of what is called a pseudo-selector, that is a selector that is neither a widget or a style, but is a style selector that can be used to apply a presentation style if a certain condition is fulfilled.  In this case we can use the “odd” and/or “even” pseudo-selector to apply a presentation style, in this case the background colour, to odd and/or even rows.

Read more at https://4js.com/ask-reuben/ig-4/