Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with table tr and td, please help! 1

Status
Not open for further replies.

ColdFusionKing

Programmer
Dec 5, 2002
145
GB
This is more of a html question really. I have this table with <tr> tags, the first <tr> tag displays the column headings and the second <tr> displays the data for the columns. Here it is.

<table border=&quot;0&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<TR vAlign=&quot;top&quot;>
<td vAlign=&quot;bottom&quot; width=&quot;100%&quot;>
<table border=&quot;1&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<TR vAlign=&quot;top&quot;>
<TD vAlign=&quot;bottom&quot; width=&quot;20%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Date/Time</font>
</TD>
<TD vAlign=&quot;bottom&quot; width=&quot;58%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Document</font>
</TD>
<TD vAlign=&quot;bottom&quot; width=&quot;15%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>User Name</font>
</TD>
<TD vAlign=&quot;bottom&quot; width=&quot;7%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Status</font>
</TD>
</TR>
</table>
</td>
</TR>
<TR>
<td width=&quot;100%&quot;>
<table border=&quot;1&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<TR vAlign=&quot;top&quot;>
<TD vAlign=&quot;top&quot; width=&quot;20%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>26/09/2003 18:20:46</TD>
<TD vAlign=&quot;top&quot; width=&quot;58%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;> /blah blah blah/Helpdesk/Uploads/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolderblahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder.doc
</TD>
<TD vAlign=&quot;top&quot; width=&quot;15%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>NATIONAL\raynem10
</TD>
<TD vAlign=&quot;top&quot; width=&quot;7%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>FAILED
</TD>
</TR>
</table>
</td>
</TR>
</table>

If you copy and save the above code in a html/cf file and view it on the browser, you will see the data in the &quot;document&quot; column screws up the table display. I am trying to find a way around this problem. Can somebody please show me how to do this.

Best Regard
Allan
 
try this:
<code>
<table border=&quot;0&quot; width=&quot;100%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<TR vAlign=&quot;top&quot;>
<th vAlign=&quot;bottom&quot; width=&quot;20%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Date/Time</font>
</Th>
<Th vAlign=&quot;bottom&quot; width=&quot;58%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Document</font>
</Th>
<Th vAlign=&quot;bottom&quot; width=&quot;15%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>User Name</font>
</Th>
<Th vAlign=&quot;bottom&quot; width=&quot;7%&quot; bgColor=&quot;#444444&quot; class=&quot;arttext&quot;>
<font color=&quot;#FFFFFF&quot;>Status</font>
</Th>
</TR>
<TR vAlign=&quot;top&quot;>
<TD vAlign=&quot;top&quot; width=&quot;20%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>26/09/2003 18:20:46</TD>
<TD vAlign=&quot;top&quot; width=&quot;58%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;> /blah blah blah/Helpdesk/Uploads/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolderblahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder.doc
</TD>
<TD vAlign=&quot;top&quot; width=&quot;15%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>NATIONAL\raynem10
</TD>
<TD vAlign=&quot;top&quot; width=&quot;7%&quot; bgColor=&quot;E4E4E4&quot; class=&quot;arttext&quot;>FAILED
</TD>
</TR>
</table>
</code>

Erwin Oosterhoorn
Analyst Programmer,
ice hockey player/fan.
 
I replaced my code with yours. When viewed on the browser the data in the &quot;document&quot; column (blah..) stretches to the right, I have to use the mouse to scoll to the right. I don't want the column to expand in this way. If the data in the column is too long, I want it to be displayed in the next row. Can you think of anything?
 
this problem is because it's one long string of characters, and the browser can't split the text anywhere. You need to do something to force a break in the text. Maybe search through the string and replace the '/' with '/ ' so text can be wrapped in the cell.

Erwin Oosterhoorn
Analyst Programmer,
ice hockey player/fan.
 
len(string)

Erwin Oosterhoorn
Analyst Programmer,
ice hockey player/fan.
 
Hi Erwin,

I've tried to use some logic to do this, but am getting very desparate. Can you post something?
 
OK, here is an example for splitting the string:
<code>
<cfset i_max_string = 50><!--- max length of string --->
<cfset s_file_name = &quot;/blahblahblah/Helpdesk/Uploads/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolderblahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder/blahblahblahFolder.doc&quot;>
<cfif Len(s_file_name) GT i_max_string>
<cfloop index=&quot;i&quot; from=&quot;#i_max_string#&quot; to=&quot;#Len(s_file_name)#&quot; step=&quot;#i_max_string#&quot;>
<cfset temp = Left(s_file_name, i) & &quot;[space] &quot; & right(s_file_name, Len(s_file_name) - i )>
<cfset s_file_name = temp>
</cfloop>
</cfif>
</code>
Replace the [space] with a character if you want to see where the break is. You can also replace the first / before a set amount of characters. Reverse the string from position 1 to i_max_string, search for the first / and replace with /space.

Erwin Oosterhoorn
Analyst Programmer,
ice hockey player/fan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top