I am using a primefaces datatable. Each row in the datatable will have 24 columns representing 24 hour values. As of now I am using a static xhtml with 24 columns coded individually, I would like it to make it dynamic so that the code can be maintained easily, The input textbox under the columns are fetched from an array. When I try to use the over the array I dont see the columns getting created horizontally. PFA the below code.
Inside the parent.xhtml we have the dataTable,
<p:dataTable id="tbl" var="row" value="#{prvdr.values}"
binding="#{prvdr.dataTable}" widgetVar="table" filteredValue="#{prvdr.filteredList}"
scrollable="true" scrollWidth="auto" lazy="false" rowKey="#{row.id}" paginator="true"
filterEvent="enter" paginatorTemplate="#{appmsg['label.recordsperpage']}: {RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15,20,50" editable="true" editMode="cell">
<ui:include src="hourly.xhtml" />
</p:dataTable>
Inside the included hourly.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:repeat items="#{row.hourArray}" var="item" varStatus="myVarStatus">
<p:column styleClass="col-right col-90">
<f:facet name="header">
<h:outputText value="myVarStatus.index" escape="false" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{item}" escape="false">
<f:convertNumber maxFractionDigits="3" minFractionDigits="3"
maxIntegerDigits="5" />
</h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText value="#{item}" maxlength="10" size="10">
<f:convertNumber maxFractionDigits="3" minFractionDigits="3"
maxIntegerDigits="5" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
</ui:repeat>
</ui:composition>
the Row object is backed by a java class where hourArray is represented as below.
private BigDecimal[] hourArray;
I tried both ui:repeat and c:forEach but couldnt create the desired view. Any help and suggestions are welcome.