Want to Stop Text Wrap Around Problem in Table Cells

I display a table inside a <div> because I want to show scrollbars. However, I have wrapped around text inside table cells although I provide enough width to each column and used white-space:nowrap; overflow-x:scroll. How do I make all text in each table cell displayed in one single line?

...

<style>

.scrollbar

{

overflow-y:auto;

overflow-x:scroll;

scrollbar-face-color: #C0C0C0;

scrollbar-arrow-color: #587090;

scrollbar-track-color: #90A0B0;

scrollbar-shadow-color: #7B7B7B;

scrollbar-highlight-color: #F9F9F9;

scrollbar-3dlight-color: #FFFFFF;

scrollbar-darkshadow-Color: #8B8B8B;

}

.lovTableDefault

{

BORDER-TOP: #006699 1.5px solid;

BORDER-LEFT: #006699 1.5px solid;

BORDER-RIGHT: white 1.5px solid;

BORDER-BOTTOM: white 1.5px solid;

padding: 3px;

overflow-y:auto;

overflow-x:scroll;

white-space: nowrap;

}

.tableHeaderDefault

{

text-align: left;

white-space: nowrap;

FONT-SIZE: 0.7em;

FONT-FAMILY: Arial, Helvetica, sans-serif;

}

.codeColumn

{

text-align: left;

FONT-FAMILY: Verdana, sans-serif;

font-size:0.7em;

width: 7em;

white-space: nowrap;

border: 0;

}

.descriptionColumn

{

text-align: left;

FONT-FAMILY: Verdana, sans-serif;

font-size:0.7em;

width: 30em;

white-space: nowrap;

border: 0;

}

</style>

....

<div style="height:12em; width:20em;" id="container" class="scrollbar">

<h:dataTable value="#{countriesManagementBean.countriesList}" var="country"

id="countryTable" styleClass="lovTableDefault"

border="0" cellspacing="1" bgcolor="#FFFFFF"

headerClass="tableHeaderDefault" columnClasses="codeColumn, descriptionColumn" >

<h:column>

<f:facet name="header">

<h:outputText style="width:7em; white-space:nowrap;" value="Code"/>

</f:facet>

<h:outputText value="#{country.code}"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText style="width:30em; white-space:nowrap;" value="Description"/>

</f:facet>

<h:outputText value="#{country.description}"/>

</h:column>

</h:dataTable>

</div>

....

....

[3194 byte] By [jiapei_jena] at [2007-11-27 10:14:03]
# 1

CSS.cell {

white-space: nowrap;

}

in columnClasses should work. Which browser are you using?

BalusCa at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I use IE6.

I have

columnClasses="codeColumn, descriptionColumn"

in the <h:dataTable ...> tag. And in my CSS, I have:

.codeColumn

{

text-align: left;

FONT-FAMILY: Verdana, sans-serif;

font-size:0.7em;

width: 7em;

white-space: nowrap;

border: 0;

}

.descriptionColumn

{

text-align: left;

FONT-FAMILY: Verdana, sans-serif;

font-size:0.7em;

width: 30em;

white-space: nowrap;

border: 0;

}

width:30em; should be enough to accomodate all description text. However, my text stills wraps around in table cells.

jiapei_jena at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Could it possibly be because the <t:div> you wrapped your dataTable in only has a width of 20em so only 13em is available to the description column (7 is taken up by the code)? Just a guess.

jco1323a at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

To add to that because it wasn't quite clear, maybe the column isn't recognizing the overflow style of the div. I had this issue when trying to make vertical scrollbars in my dataTables and had to add the overflow style to my column class as well as the div.

jco1323a at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

The width of my <div>, which defines both vertical and horizontal scrollbars is 20em. And the width of my code column is 7em, my description column is 30em.

I intentionally set the width of <div> less than the width of all my columns. The idea is that I want the horizontal scrollbar to work. It is not out of my initiative. It is one of client's requirements.

Now, I have wrapped around text in table cells and do not know what to do.

jiapei_jena at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

The text wrapping around problem is gone if I put <!-- --> on the very top of the JSP. But, the JavaScript in that page stops working.

I wonder if IE6 does these things to us.

jiapei_jena at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

> The text wrapping around problem is gone if I put

> <!-- --> on the very top of the JSP.

Ah, this makes me think that you are using a DOCTYPE that is causing IE to use "quirks" mode or not. You might want to research that a little bit.

RaymondDeCampoa at 2007-7-28 15:30:52 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...