Fixed Sized Columns in TABLE on screen

Hi,

I am attempting to do the following:

1. Have a table with width = 100px 2. Have 4 columns with width = 20px, 30px, 10px, 40px 3. Have the content within the rows word wrapped as per the size of their respective columns - 20px, 30px, 10px, 40px

I am using Rails 2.3.2, want to avoid using ready-made plugins.

Can someone advise :slight_smile:

Yes I know. But... I mentioned Rails may be Rails has some helpers which might help me in the process. Even in CSS, does someone has some advise?

The word wrap it self has a helper in Rails. function. Word_wrap. Can someone suggest how to refer this word_wrap <%= word_wrap ( "sdnglsdngldsngldsngsdsdgdsg", :line_width => 3 ) %> dint work for me in a view file. What am I doing wrong?

Ritvvij wrote:

Hi,

I am attempting to do the following:

1. Have a table with width = 100px 2. Have 4 columns with width = 20px, 30px, 10px, 40px 3. Have the content within the rows word wrapped as per the size of their respective columns - 20px, 30px, 10px, 40px

Tables do this automatically - what are we missing here?

Programmatically, if you really want to do in the server what your browsers could do, then word_wrap( :line_width => 3 ) might be giving you lines with 3 characters, which is hardly what you need. And even if you figured out the number of characters in 30px, if the browser disagreed then it would wrap your wrap, and the lines would look disgusting.

What I have right now is:

<div id="content">     <table>     <tr class="header">         <th style="max-width:12px;">Name</th>         <th>.....

    </tr>     <% @users.each do |user| %>     <tr class="<%= cycle :odd, :even %>">         <td><%=h word_wrap(user.full_name, :line_width => 10) %></td>

And it does not wrap it... the column size increases :expressionless: