simple, flexible and fast html table generator
Add this line to your application's Gemfile:
gem 'table_go'
And then execute:
$ bundle
Or install it yourself as:
$ gem install table_go
example in HAML (or more here: http://table-go-example.exsemt.de/)
= table_go_for @orders, Order, :title => 'one Table',
:table_html => { :id => :the_table },
:row_html => { :class => lambda { cycle('even', 'odd') },
:id => lambda { |record| dom_id(record, :special) }} do |t|
- t.column :id,
:column_html => { :class => lambda { |record, column, value| value.even? ? :even : :odd } }
- t.column :my_type,
:send => :titleize
- t.column :vat,
:label => 'as percent',
:as => :percent
- t.column :price,
:label => 'as € currency',
:as => :currency
- t.column :date_of_order,
:header_html => { :class => :date, :style => :xyz, :id => :date_column },
:column_html => { :class => :date,
:style => :xyz,
:id => lambda { |record, column, value| "date_#{record.id}" }}
- t.column :date_of_order,
:as => :date,
:as_options => { :format => :short }
- t.column :date_of_order,
:label => 'with custom formatter',
:as => lambda { |value, record, column| value.to_s.reverse }
- t.column :date_of_order,
:label => 'with block level custom formatter' do |value, record, column|
%b do it
%br
= value
%b like u want
- t.column :xmas_bonus,
:as => :boolean,
:label => 'as boolean'
- t.column :customer,
:method => :name
- add sorting for column
- bugfixing
- fixed generate csv bug
- new method: table_rows_for
- table options: render_rows_only, without_header
- speed optimisation for haml templates
- allowing block style table options
- small fixes
- tests
- tests
- allow multiline block level customization of columns
- simple, flexible and fast html table generator
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request