Simple Row Style Alternator
In your view (rhtml):
[code lang="xml"]| Name |
|---|
| <%= user.name %> |
In your helper (rb): Updated!
[code lang="ruby"] def row_style @row_index ||= 0 @row_index += 1 @row_index % 2 == 0 ? "Even" : "Odd" end [/code]In your view (rhtml):
[code lang="xml"]| Name |
|---|
| <%= user.name %> |
In your helper (rb): Updated!
[code lang="ruby"] def row_style @row_index ||= 0 @row_index += 1 @row_index % 2 == 0 ? "Even" : "Odd" end [/code]row_index = 1 - (row_index ||= 0)row_indices ||= {}
row_indices[key] = 1 – (row_indices[key] ||= 0)
row_indices[key] == 0 ? “even” : “odd”Trackback link:
Please enable javascript to generate a trackback url