p:repeat 在 p:dashboard 内迭代面板
p:repeat inside of p:dashboard to iterate over panels
我使用 PF 5.3.5 和 Mojarra 2.2.8。我正在将 ice:panelPositioned
组件迁移到 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>
我收到这个错误
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)
有关于 p:repeat
组件所需属性的讨论。
https://github.com/primefaces/primefaces/issues/1627
它不适用于 JSF 经典 ui:repeat
组件。
请问我该怎么做?提前致谢。
p:dashboard
(不幸的是)不知道如何将 ui:repeat
处理为 child。您应该为此使用 c:forEach
而不是 ui:repeat
。 c:forEach
在视图构建时运行并创建面板,因此在渲染时 p:dashboard
只能看到面板。请参阅使用 c:foreach...请参阅 JSTL in JSF2 Facelets... makes sense?
我使用 PF 5.3.5 和 Mojarra 2.2.8。我正在将 ice:panelPositioned
组件迁移到 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>
我收到这个错误
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)
有关于 p:repeat
组件所需属性的讨论。
https://github.com/primefaces/primefaces/issues/1627
它不适用于 JSF 经典 ui:repeat
组件。
请问我该怎么做?提前致谢。
p:dashboard
(不幸的是)不知道如何将 ui:repeat
处理为 child。您应该为此使用 c:forEach
而不是 ui:repeat
。 c:forEach
在视图构建时运行并创建面板,因此在渲染时 p:dashboard
只能看到面板。请参阅使用 c:foreach...请参阅 JSTL in JSF2 Facelets... makes sense?