Reputation: 4677
I am using the github version of active_Admin as can be seen from my gemfile:
gem 'activeadmin', github: 'activeadmin'
I am trying to change the column width of a column in an index table. According to the documentation found here, it should be done like this:
column :notes, min_width: "400px"
column :notes, max_width: "800px"
However, the code above is not working. The column is 100px. How do I get this to work?
Upvotes: 3
Views: 6451
Reputation: 34318
Try this:
columns do
column max_width: "800px", min_width: "400px" do
span "notes contents goes here"
end
end
See Custom Column Widths section from the documentation.
If the above way does not work for you, you can still do it the following way:
column :notes do
div(class: "notes") do
span "notes contents goes here"
end
end
Define the css rule in app/assets/stylesheets/active_admin.css.scss
file:
div.notes { width: 500px; }
Upvotes: 1
Reputation: 4516
This works today
index do
style do
[".col-name{width: 130px}"].join(' ')
end
column :name
actions
end
Active admin uses this gem. https://activeadmin.github.io/arbre/
Above puts the style right into the HTML. That's okay because it works.
I mean your HTML will be ugly, but it works.
Upvotes: 1
Reputation: 61
https://github.com/activeadmin/activeadmin/issues/4091
Unfortunately max_width only exists on "pages" (i.e. register_page), and not on "resources" (i.e. register). Instead you can do this:
.col-<column_name> { max-width: 200px; }
Upvotes: 4