Link to home
Start Free TrialLog in
Avatar of TheChos
TheChos

asked on

Expanding a column

I'm having problems when I try to change the size of a column in one of my tables.  Basically, I want to hide a column (by initially setting the size to 0) and then expand it to show a table within this column.  The problem that I'm experiencing is that when the column expands to the correct size, the size of the preceeding columns in the table are then reduced and the format of the table is all messed up.  I'm using JavaScript to set the size of the DIV to 450.  Below is the JS & html that I'm using for my page.

<script language="JavaScript">
function ResizeColumn() {
      var objRS = document.getElementById("EmpInfo").style;
      objRS.display="block";
}
</scipt>

<table border="0" cellspacing="0" cellpadding="0">
      <tr>
            <td width="150"><p style="margin-left: 15">Employee Name</td>
            <td width="150">Title</td>
            <td width="0">
                  <div id="EmpInfo" style="display: none">
                        <table border="0" width="450" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="33%">InfoA</td>
                            <td width="33%">InfoB</td>
                            <td width="34%">InfoC</td>
                          </tr>
                        </table>
                  </div>
            </td>
            <td width="20" align="right">Yrs</td>
            <td width="10">x</td>
      </tr>
</table>

Please note that when the column is expanded, the table should exceed the size of the screen.  I noticed that the horizontal scrollbars do not appear at the bottom of the window when the DIV is displayed.
Avatar of raj3060
raj3060
Flag of United States of America image

Try this:

<table border="0" cellspacing="0" cellpadding="0">
     <tr>
          <td width="150"><p style="margin-left: 15">Employee Name</td>
          <td width="150">Title</td>
          <td width="450" id="EmpInfo" style="display: block">              
                    <table border="0" width="100%" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="33%">InfoA</td>
                        <td width="33%">InfoB</td>
                        <td width="34%">InfoC</td>
                      </tr>
                    </table>              
          </td>
          <td width="100" align="right">Yrs</td>
          <td width="100">xyz</td>
     </tr>
</table>
This should be 'none' at first:

<td width="450" id="EmpInfo" style="display: none">
Avatar of TheChos
TheChos

ASKER

This almost works.  What appears to be happening is that when I expand the column, the table expands but only to the size of the screen.  It adjusts all the columns so that everything fits width-wise on the screen.  How can I make the table expand beyond the size of the screen?
ASKER CERTIFIED SOLUTION
Avatar of raj3060
raj3060
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TheChos

ASKER

Thank you, it worked perfect!