We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Column size in JSF dataTable

Medium Priority
11,529 Views
Last Modified: 2008-01-09
Hi. I have a JSF dataTable with a string like "2006-04-05 14:58:00" in the far right column.

The problem is that this string looks like this:

2006-
04-05
14:58:00


So I need either to get a nowrap on my cells in that column,
or to be able to explicitly set the size of the cells in the column
in order to prevent this from happening. Anyone know how this
can be achieved? (see code below)

\\Karl



THE CODE:


<h:dataTable id="table" columnClasses="list-column-left, list-column-left, list-column-left"
                                      headerClass="list-header" rowClasses="list-row" styleClass="list-background"
                                      value="#{jobList.jobs}" var="jobs">
                           
                            <h:column>
                                <c:facet name="header">
                                    <h:outputText value="Job name:"/>
                                </c:facet>
                                <h:outputText id="name" value="#{jobs.name}"/>
                            </h:column>
                           
                           
                            <h:column>
                                <c:facet name="header">
                                    <h:outputText value="Commands"/>
                                </c:facet>
                                <h:commandButton id="runJob" action="#{jobList.runJob}"
                                    immediate="true" value="#{jobList.runLable}" type="SUBMIT" />
                                <h:commandButton id="editJob" action="#{jobList.viewJobDetail}"
                                    immediate="true" value="#{jobList.editLable}" type="SUBMIT"/>
                                <h:commandButton id="deleteJob" action="#{jobList.deleteJob}");"
                                    immediate="true" value="#{jobList.deleteLable}" type="SUBMIT"/>
                            </h:column>
                           
                            <h:column>
                                <c:facet name="header">
                                    <h:outputText value="Next trigger time:"/>
                                </c:facet>
                                <h:outputText id="triggerTime" value="#{jobs.nextTriggerTime}"/>
                            </h:column>                          
                           
                        </h:dataTable>
Comment
Watch Question

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2004

Commented:
Try changing:

                            <h:column>
                                <c:facet name="header">
                                    <h:outputText value="Next trigger time:"/>
                                </c:facet>
                                <h:outputText id="triggerTime" value="#{jobs.nextTriggerTime}"/>
                            </h:column>                          

to:

                            <h:column>
                                <c:facet name="header">
                                    <h:outputText value="Next trigger time:"/>
                                </c:facet>
                                <h:outputText id="triggerTime" value="#{jobs.nextTriggerTime}"/>
                                <f:attribute value="true" name="nowrap" />
                            </h:column>                          

Tim

Author

Commented:
                           <h:column>                                
                                <c:facet name="header">
                                    <h:outputText value="Next trigger time:"/>
                                </c:facet>                                
                                <h:outputText style="width:200px" id="triggerTime" value="#{jobs.nextTriggerTime}"/>                                
                            </h:column>  


Works fine. I didn't get the

<f:attribute value="true" name="nowrap" />

 solution to work though.


Thanks!

- Karl
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.