Permalink
Browse files

Update README to include detail about column configuration.

  • Loading branch information...
1 parent 74e88af commit 7e275ab0f42db4262e1e65a2ff8616926d0169dc @bobbytables committed Oct 31, 2012
Showing with 26 additions and 1 deletion.
  1. +26 −1 README.md
View
@@ -136,7 +136,7 @@ end
You can also configure specific tables separately.
```ruby
-class TableCloth::Base
+class UserTable < TableCloth::Base
column :name, :email
action(:edit) {|object, view| view.link_to "Edit", edit_object_path(object) }
@@ -156,6 +156,31 @@ config.table.cellpadding = 1
config.td.valign = 'top'
```
+You also have the option to specify options on a specific column with the ```td_options``` key.
+
+```ruby
+class UserTable < TableCloth::Base
+ column :name, td_options: { class: "awesome-column" }
+end
+```
+
+Not good enough? Fine... you can do row / column specific config as well for a TD.
+
+```ruby
+class UserTable < TableCloth::Base
+ column :name do |user|
+ [user.name, {class: "#{user.type}-user"}]
+ end
+end
+
+```
+
+This would render something alow the lines of:
+
+```html
+<td class="admin-user">Robert Ross</td>
+```
+
## Thanks
- TableCloth was built during my open source time at [philosophie](http://gophilosophie.com)

0 comments on commit 7e275ab

Please sign in to comment.