?
Solved

Expanding a column

Posted on 2006-04-19
5
Medium Priority
?
327 Views
Last Modified: 2008-02-26
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.
0
Comment
Question by:TheChos
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:raj3060
ID: 16487586
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>
0
 
LVL 11

Expert Comment

by:raj3060
ID: 16487600
This should be 'none' at first:

<td width="450" id="EmpInfo" style="display: none">
0
 

Author Comment

by:TheChos
ID: 16488626
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?
0
 
LVL 11

Accepted Solution

by:
raj3060 earned 2000 total points
ID: 16488936
Define the table width how much you want it to be:
 e.g.
<table border="0" cellspacing="0" cellpadding="0" width="850">
0
 

Author Comment

by:TheChos
ID: 16490183
Thank you, it worked perfect!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question