开发者

Datatable issues when presenting dynamic columns

开发者 https://www.devze.com 2023-03-17 07:51 出处:网络
I\'ve got a NULLPointerException. I have iplemented an object called Workhours, which has list of Hours and a workday (enum value).

I've got a NULLPointerException. I have iplemented an object called Workhours, which has list of Hours and a workday (enum value). Now, I have a list I would like to present it in a datatable with the workday (enum) name as a row, and the hours as columns. Now, this is what I tried:

                <p:dataTable id="dtWorkHours" var="workhour" value="#{uploadImagesPage.lwh}"  >
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Days"></h:outputText>                               
                        </f:facet>
                        <h:outputText value="#{workhour.workday}"></h:outputText>
                    </p:column>
                    <p:columns value="#{workhour.luh}" var="columnUntilHours" columnIndexVar="index">
                        <f:facet name="header">
                             #{columnUntilHours.untilhours}
                        </f:facet>
                        <h:selectBooleanCheckbox value="#{columnUntilHours.checked}" >
                        </h:selectBooleanCheckbox>
                    </p:columns>
                </p:dataTable>

I checked initialization of WorkHours object and it seems everythings's in place. Is there any reason why I p:columns doesn't work (an开发者_开发知识库d when I put it out, the workday presentation as row works)?

Thanks in Advance !


I do not believe it is possible to mix dynamic and static columns within a single Primefaces dataTable. You must choose one method or the other.

If you wish to show the workday column within this then perhaps you can create create a viewable composite entity type that combines properties of both workday and the row entities into a single type. Workday can be just another object that always exist in your dynamic column collection.

0

精彩评论

暂无评论...
验证码 换一张
取 消