3

I use PF 5.3.5 and Mojarra 2.2.8. I am migrating an ice:panelPositioned component to Primefaces.

<p:dashboard id="dashboard" model="#{customAttributesSettings.model}" disabled="#{!customAttributesSettings.editable}" styleClass="positionPanelContainer positionPanelBox positionedPanelBoxR">
   <p:ajax event="reorder" listener="#{customAttributesSettings.changed}" update="@form" />
   <p:repeat var="column" value="#{customAttributesSettings.availableColumns}" offset="" size="" step="" varStatus="">
      <p:panel id="locked" header="Locked">
         <p:selectBooleanCheckbox partialSubmit="true" value="#{column.selected}" disabled="#{!customAttributesSettings.editable}" valueChangeListener="#{customAttributesSettings.selectionMade}" />
         <h:outputText value="#{column.name}" style="width: 200px;" disabled="#{!customAttributesSettings.editable}" styleClass="columnName#{column.selected ? '' : 'Dis'}" />
         <p:inputText partialSubmit="true" value="#{column.type.width}" disabled="#{!customAttributesSettings.editable}" />
      </p:panel>
   </p:repeat>
</p:dashboard>

I get this error

com.sun.faces.application.view.FaceletViewHandlingStrategy.handleRenderException Error Rendering View[/secure/settings/settings.xhtml] java.lang.ClassCastException: org.primefaces.component.repeat.UIRepeat cannot be cast to org.primefaces.component.panel.Panel at org.primefaces.component.dashboard.DashboardRenderer.findWidget(DashboardRenderer.java:96)

There is a discussion about required attributes for p:repeat component. https://github.com/primefaces/primefaces/issues/1627

It does not work with the JSF classic ui:repeat component. How shall I do it, please? Thanks in advance.

Apostolos
  • 10,033
  • 5
  • 24
  • 39
Skyware
  • 352
  • 1
  • 7
  • 16

1 Answers1

3

The p:dashboard has (unfortunately) no knowledge of how to process a ui:repeat as a child. You should use a c:forEach for this instead of a ui:repeat. The c:forEach runs at view build time and create the panels so at render time the p:dashboard only sees panels. See Use a c:foreach...See JSTL in JSF2 Facelets... makes sense?

Community
  • 1
  • 1
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • SOLVED IT BY – Skyware Aug 25 '16 at 09:32
  • We see questions like this multiple times a day. I've started a documentation topic (request). If I can find some time this evening I'll create a first revision. http://stackoverflow.com/documentation/jsf/topic-requests/6074 – Jasper de Vries Aug 25 '16 at 10:24
  • @JasperdeVries: Don't you think the duplicate is already fully describing that? I can 'create' the documentation topic for you, but just wonder what it should/would contain that is not already in the duplicate – Kukeltje Aug 25 '16 at 10:34
  • Isn't that the same for all documentation topics? There are a lot of questions covering a lot of topics. I hope that having documentation on this subject makes it easier to find. Same goes for passing parameters in some form. – Jasper de Vries Aug 25 '16 at 10:44
  • Documentation is funny for code examples/snippets, but for Q&A? We already have a platform for that .. – BalusC Aug 26 '16 at 06:17