Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

html table and moving cell sizes

Posted on 2010-11-26
8
Medium Priority
?
172 Views
Last Modified: 2012-05-10
i am using ie and trying to make up a grid like excel but when you enter in the data if its longer than the cell then the cell will expand. what i want to do is to have the cell grow in height to make the adjustment instead of in width. the data is being returned via ajax and will have many
differing characer count as the data is returned

$ret.='<table>';
<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';
            
$ret.='</table>'; data layup
0
Comment
Question by:sydneyguy
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 668 total points
ID: 34220975
If you have continuous string in the TD, you won't be able stop it from expanding. You can add a DIV tag in the TD and set a fixed width to that and set overflow to hidden. (extra text will be cut off from the display)

Btw, Add TR tags around the TDs.

Found this here http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/HTML/Q_21605705.html
<td><div style="width:152px; overflow;hidden;">'.$nyz'</div></td>

Open in new window

0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 668 total points
ID: 34220987
If you're trying to get all the sections to line up together, you need to make it One table and not a bunch of little ones.  If it's One table, then all of the columns will have the same width from top to bottom.  Start the table at the top, loop thru your data, and end the table after the loop.  Like below:
echo '<table>';
///
while(...) {
$ret.='<tr>';
$ret.='<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';            
$ret.='</tr>'; 
}
echo '</table>';

Open in new window

0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 34220990
This would be better.
echo '<table>';
///
while(...) {
$ret = '<tr>';
$ret.='<td width="152" style="width:152">'.$nyz'</td>
<td width="152" style="width:152">'.$123.'</td>
<td width="152" style="width:152">'.$abv.'</td>
<td width="152" style="width:152">'.$xyz.'</td>';            
$ret.='</tr>'; 
echo $ret;
}
echo '</table>';

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 13

Assisted Solution

by:gbanik
gbanik earned 664 total points
ID: 34222764
Just echo this before the body
echo '<STYLE>td {width:152px;vertical-align:top}</STYLE>';
and create your table and columns without any width.

If you are filling data by AJAX, it may be better to use DIVs rather than TABLEs and TDs.
0
 
LVL 13

Expert Comment

by:gbanik
ID: 34222772
and of course do what DaveBaldwin suggested... create ONE table rather than many small ones. Data within cells (cell widths) are restricted by column widths across all rows of the table.
0
 

Author Comment

by:sydneyguy
ID: 34223494
thanks for that am playing with a sample file now so will know by the end of the day. when we have it going.
welcome to a fantastic sunday every one,
0
 

Author Closing Comment

by:sydneyguy
ID: 34398829
thanks for the help rebuit the lay out and now works fine
have a good christmas and a good new year
0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 34399250
Glad to help. Thanks for the points.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

824 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