how do I resize table columns the right way. I simply tried the
following:
$(''col1'').setStyle({width: ''30%''});
$(''col2'').setStyle({width: ''70%''});
on:
<table id="table1" style="width: 200px;">
<tbody>
<tr>
<td id="col1" style="width: 50%">
col1
</td>
<td id="col2" style="width: 50%">
col2
</td>
</tr>
</tbody>
</table>
it works fine for IE, Firefox, Safari but fails for Opera so I
wondered if this is the right way of doing this.
thanks Björn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
You might want to look into using col''s and colgroup''s:
<table style="width: 200px;">
<colgroup>
<col id="col1" />
<col id="col2" />
</colgroup>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test string</td>
<td>Test string</td>
</tr>
</tbody>
</table>
That you have one element you can set the width on. You''re supposed to
be able to set the style (color, font-weight, etc..) of each column,
but in my experience this isn''t very well supported. For a change
it''s
not Firefox that adheres to W3C standards but IE (both 6 & 7)...
Setting the width works like a charm though...
For more info on columns in tables look here:
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.4
Greetz,
Wizz
On Nov 22, 3:59 pm, dasboe
<bjo...-C/9M+bQ+NTFiszJb17IBaA@public.gmane.org>
wrote:> how do I resize table columns the right way. I simply tried the
> following:
>
> $(''col1'').setStyle({width: ''30%''});
> $(''col2'').setStyle({width: ''70%''});
>
> on:
>
> <table id="table1" style="width: 200px;">
> <tbody>
> <tr>
> <td id="col1" style="width: 50%">
> col1
> </td>
> <td id="col2" style="width: 50%">
> col2
> </td>
> </tr>
> </tbody>
> </table>
>
> it works fine for IE, Firefox, Safari but fails for Opera so I
> wondered if this is the right way of doing this.
> thanks Björn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
thank you for the reply. I now tried to dynamically change the width
of colgroups:
$(''col1'').setStyle({width: ''30%''});
$(''col2'').setStyle({width: ''60%''});
on:
<table style="width: 200px;" cellspacing="0"
cellpadding="0">
<colgroup>
<col id="col1" style="width: 50%" />
<col id="col2" style="width: 50%" />
</colgroup>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>
col1
</td>
<td>
col2
</td>
</tr>
</tbody>
</table>
the only browser this has any effect is IE. Firefox, Safari & Opera
all ignore any dynamic changes to the colgroups. Using Firebug it
seems the width values have correctly been changed for each col but it
does not force the table to be rerendered.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---