I have a 14 column table that needs to fit in a standard 800x600 browser window without scrolling across the web page. I would like to display multi-row headings and multi-row fields for each record to reduce the width of the table. Is there a table parameter or table component that supports this capability? The example below may not line up properly if the size of this compose window changes, but I hope it illustrates the point. Please respond as soon as possible so we can proceed with development. Thanks, Stan.
JSF MultiRow Table Component
Heading1 Heading2 Heading3 Heading4 Heading5
Heading6 Heading7 Heading8 Heading9 Heading10
Heading11 Heading12 Heading13 Heading14
Record 1
Field1 Field2 Field3 Field4 Field5
Field6 Field7 Field8 Field9 Field10
Field11 Field12 Field13 Field14
Record 2
Record 3
....
Hi Stanley:
The easiest way to do this is to embed breaks in your output code to force wrapping where you need it.For example, in the column header, you could do something like this:<f:facet name="header"> <h:outputText escape="false" value="Last<br /> Name" /> </f:facet>
Best,Jim
I'm doing something similar but I'm creating all of the column data in the backing bean since my grids are dynamic. I tried the below but it only rendered as Average<BR>Factor as the column heading. I want the new line.
String header = "Average<BR>Factor";
UIOutput columnHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); columnHeader.setValue(header); columnHeader.setId(viewRoot.createUniqueId()); column.setHeader(columnHeader);
I tried the following but this didn't work
UIOutput columnHeader = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); HtmlOutputText out = new HtmlOutputText(); out.setEscape(false); out.setId(viewRoot.createUniqueId()); out.setValue(header); columnHeader.setValue(out); columnHeader.setId(viewRoot.createUniqueId()); column.setHeader(columnHeader);
Thanks in advance,
Eric Bieche
Did you try it with escape="true"? In this case, I think you want to escape the HTML tags, so that they'll be passed to the browser to interpret.
Thanks Jim -
Yeah I finally figured it out about an hour or so after I posted. I think that my problem was that I was using UIOutput columnHeader = new UIOutput(); and trying to set its value with the HtmlOutputText object. It worked by setting the Column's header directly with the HtmlOutputText ojbect please see below.
Thanks,
HtmlOutputText out = new HtmlOutputText(); out.setEscape(false); // Used to allow newLine characters in the heading name via <br> out.setId(viewRoot.createUniqueId()); out.setValue(header); column.setHeader(out);
Great! I'm glad this is working for you.