tags:

views:

22

answers:

1

Is there anyway to stretch the width of a new row without to stretch the width of parent node (table)?

Structure example:

<table>
  <tr>
    <td>
      <div id="div_1"> Block 1 </div>
    </td>
    <td>
      <div id="div_2"> Block 2 </div>
    </td>
  </tr>
  <tr>
    <td>
      <div id="div_3"> Block 3 </div>
    </td>
    <td>
      <div id="div_4"> Block 4 </div>
    </td>
  </tr>
</table>

jQuery code:

var newRow = "<tr><td colspan="2"><div>This is a great row, bla,bla,bla....</div></td></tr>";
$('#div_1').closest('tr').after(html);

I want to put the new row without to stretch the table's width.

+1  A: 

Give the table itself a fixed width and then it shouldn't expand to fit its contents.

Fiona Holder
It not works, I tried:var sizeTest = $('#div_1').closest('table').outerWidth();$('#div_1').closest('tr').after(html);$('#div_1').closest('table').width(sizeTest);I done it because my table is dinamic. But the my columns resized.
Lenard
Do you not just know a fixed width for your table to be? Are you re-calling your resizing code after adding the new row, because it may be re-setting. I can't really tell without the code for it.
Fiona Holder