Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show data in horizontal direction using JSF dataTable

Tags:

jsf

How to display data in horizontal direction like:

lable: data
name: srinu 

in multiple rows using h:dataTable in JSF? Right now I'm getting data in vertical direction like:

| lable | data|
  data   srinu

I want it in this format:

lable: data
name: srinu

Code which I used is:

<h:dataTable id="fundInfo" value="#{clientFundInfo}" border="1"
     var="client" first="0" rows="5" rules="all">
 <h:column> 
     <h:outputText value="CLIENT:"/>
   <h:outputText value="#{client.clientName}"></h:outputText>
 </h:column>
 <h:column> <h:outputText value="FUND:"/>
  <h:outputText value="#{client.fundName}"></h:outputText>
 </h:column>
 <h:column> 
  <h:outputText value="Employer Identification Number:"/>
  <h:outputText value="#{client.empIdentificationNum}"></h:outputText>
 </h:column>
 <h:column><h:outputText value="FISCAL YEAR ENDED:"/>
  <h:outputText value="#{client.fye}"></h:outputText>
 </h:column>
 <h:column><h:outputText value="Shares Outstanding"/>
  <h:outputText value="#{client.sharesOutstanding}"></h:outputText>
  </h:column>
</h:dataTable>
like image 265
Srinivasa Reddy Avatar asked Apr 29 '10 12:04

Srinivasa Reddy


2 Answers

If you don't want it to be a table, then simply use (facelets):

<ui:repeat value="#{clientFundInfo}" var="info">
   // feel free to use any tags here
</ui:repeat>
like image 77
Bozho Avatar answered Nov 07 '22 17:11

Bozho


Not sure if it is not too late.

<table><tr>
                    <ui:repeat
                            value="#{ListOfColumns}"
                                var="columnName">

                                <td><h:dataTable
                                        value="#{ListofData}"
                                        var="Data">
                                        <h:column>
                                        <f:facet name="header">#{ColumnName}</f:facet>
                                        <h:outputText"
                                            value="#{Data.somethig)}">

                                        </h:outputText>
                                        <h:outputText"
                                            value="#{Data.somethingElse}">

                                        </h:outputText>
                                        </h:column>
                                    </h:dataTable>

                                </td>
                            </ui:repeat>
                        </tr>
                    </table>
like image 23
Icki Avatar answered Nov 07 '22 17:11

Icki