Wednesday, May 14, 2008

Alternating Table Row Colours

When listing data out in a table, it's always nice to have alternating row colours. This makes it infinitely easier to scan the table and much more enjoyable.

RoR makes it really simple to alternate row colours. A cycle function is given to aid in this task, and it simply cycles between the values given. By using this, you can specify your alternating class names here.

If you have more than one table, remember to call the reset_cycle function to reset the cycle.

Easy!


W

No comments: