bogdan / datagrid

Gem to create tables grids with sortable columns and filters
MIT License
1.02k stars 115 forks source link

Column is shown in html, even when i specify html: false #228

Closed landacorp closed 7 years ago

landacorp commented 7 years ago

I want to make the same column to be shown differently, when it's "csv" and "html"

Example:

  column(:var, html: false)
  column(:var, html: true) do |v|
    content_tag :span do
      "<b>#{v}</b>"
    end
  end

But what happens - is:

In csv page: only the first one, which is right :) In html page: i get both columns together <- the problem

I use 1.5.4 version with Rails 5.1.1 , Ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux] Ubuntu

Thanks in advance

bogdan commented 7 years ago

Here is how to do that:


column(:var) do |v|
  format(v.var) do |value|
      content_tag :span do
        "<b>#{value}</b>"
      end
    end
end