简体   繁体   中英

custom height for active admin table td not working in rails?

In my active admin page i want all my td are in same height instead of increasing the height respective to content. I try to set height but its not working.

admin_custom.css.scss

    body.active_admin {
    table td{
    height: 36px !important;
    color: black;
    width: auto;
    overflow-y: hidden;
    }
  }

这是我的形象。我希望我的地址显示在一行中。而且只有指定的宽度必须可见,并且通过单击它,我可以看到整个地址。

This is the image i have. I want my address to be displayed in a single line. And only a specified width has to be visible and by clicking it i can see the entire address

This looks like you're using a javascript/css table-displaying plugin, is that right? (I say that because of the little triangles which look like 'order by' buttons) If so then it will probably be automatically assigning what it thinks are sensible widths to the columns.

If you display the truncated version, which shows the full address when clicked, then that might solve your width problem as well. I would do this like so:

<%# in the td which has the address %>
<div class="truncated-address">
  <%= truncate(foo.address, length: 20) %>
<div>
<div class="full-address" style="display:none;">
  <%= foo.address %>
<div> 

then add this to the javascript which is used on the page - i'm writing this in jQuery, you can rewrite it yourself if you're not using jQuery.

$(".truncated-address").click(function(){ $(this).hide().siblings().show();});

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM