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?
https://github.com/activeadmin/activeadmin/issues/4091
Unfortunately max_width only exists on "pages" (ie register_page), and not on "resources" (ie register). Instead you can do this:
.col-<column_name> { max-width: 200px; }
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; }
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.