Skip to content

Commit

Permalink
Add subheading for customizing row classes and tighten up examples an…
Browse files Browse the repository at this point in the history
…d text [jgdavey#21, jgdavey#24]
  • Loading branch information
jesjos committed Mar 21, 2013
1 parent a3fea06 commit 4208913
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -238,30 +238,29 @@ will product html like:
</tbody>
</table>

For that last extra squeeze of micro-management, you can pass in a block to customize row classes:
=== Customizing row classes

For that last extra squeeze of micro-management, you can customize row classes by passing in a block:
<%= table_for(@posts) do |t|
t.row_class { |post| post.title }
t.data(:title)
end %>

Or with a string:
Or just using a string:

<%= table_for(@posts) do |t|
t.row_class("foobar")
t.data do
t.cell(:title)
end
t.data(:title)
end %>

You can also choose to omit the odd and even classes:

<%= table_for(@posts) do |t|
t.row_class(odd_even: false) { |post| post.title }
t.data do
t.cell(:title)
end
t.row_class("foobar", odd_even: false)
t.data(:title)
end %>

In HAML you would have to use a dash instead of an equals sign:
In HAML you have to use a dash instead of an equals sign:

= table_for(@posts) do |t|
- t.row_class("foo")
Expand Down

0 comments on commit 4208913

Please sign in to comment.