3 Replies Latest reply on Aug 7, 2009 5:39 AM by Neerou b

    Render dataTable columns in horizontal

    Neerou b Newbie

      I would like to have the following display:

      Neerou neerou 0 1 2 3..29

      in tabular form

      The codes used:

      <rich:dataTable id="requestTable" border="0" var="requests"
       rendered="#{not empty leavesRequestPerEmployee}"
       value="#{leavesRequestPerEmployee}">
       <rich:column>
       <h:outputText value="#{requests.employeeName}" />
       </rich:column>
       <rich:column>
       <rich:dataTable value="#{requests.leaves}" var="item" align="justify" >
       <rich:column >
       <h:outputText value="#{item.leaveType}" />
       </rich:column>
       </rich:dataTable>
       </rich:column>
       </rich:dataTable>


      Query query = entityManager
       .createQuery("select lr from LmsLeavesRequests lr where lr.lmsStatus.stsId=1");
      
       List<LmsLeavesRequests> listRequests=query.getResultList();
       //Current month =june
       Calendar cal = new GregorianCalendar(2009, Calendar.JUNE, 1);
       int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
      
       leavesRequestPerEmployee = new ArrayList<LmsLeavesByMonth>();
      
       lmsLeavesByMonth = new LmsLeavesByMonth();
      
       for(LmsLeavesRequests lmsLeavesRequests: listRequests){
       if(lmsLeavesRequests != null){
       employeeName = lmsLeavesRequests.getLmsUsersByLvsUsrId().getUsrFirstname()+ " "
       + lmsLeavesRequests.getLmsUsersByLvsUsrId().getUsrLastname();
       lmsLeavesByMonth.setEmployeeName(employeeName);
       List listDays = new ArrayList(days);
       for(int i=0; i<days; i++){
       LmsLeaveItem item = new LmsLeaveItem();
       item.setLeaveType(""+i);
       listDays.add(item);
       }
      
       lmsLeavesByMonth.setLeaves(listDays);
       leavesRequestPerEmployee.add(lmsLeavesByMonth);
       }
      
       }


      public class LmsLeavesByMonth {
       private String employeeName;
       private List<LmsLeaveItem> leaves;
      
      
       public String getEmployeeName() {
       return employeeName;
       }
       public void setEmployeeName(String employeeName) {
       this.employeeName = employeeName;
       }
       public List<LmsLeaveItem> getLeaves() {
       return leaves;
       }
       public void setLeaves(List<LmsLeaveItem> leaves) {
       this.leaves = leaves;
       }


      public class LmsLeaveItem {
       private String leaveType;
      
       public String getLeaveType() {
       return leaveType;
       }
      
       public void setLeaveType(String leaveType) {
       this.leaveType = leaveType;
       }
      
      
      
      }



      The table obtained is:
      Neerou neerou 0
      1
      2
      .....
      29

      Does anyone has an idea how to achieve the horizontal display?