假设我有这个:
<p:column headerText="R"
style=" text-align: center;"
width="10"
rendered="true">
<p:commandLink id="MRepShowButton" update=":form1:display" onclick="EditorDialog.show();" title="Editer le compte rendu">
<f:setPropertyActionListener value="#{exam}" target="#{dyna.selectedExamen}" />
<p:graphicImage id="img1" value="/images/study_Report_icons/Text/0.png" rendered="#{exam.examen.rapport.rapportWrittenState == null}"/>
<p:graphicImage id="img2" value="/images/study_Report_icons/Text/#{exam.examen.rapport.rapportWrittenState}.png" rendered="#{exam.examen.rapport.rapportWrittenState != null}"/>
</p:commandLink>
</p:column>
现在我如何使用 <p:columns>
来实现这一点
<p:columns value="#{tableBean.columns}" var="column" columnIndexVar="colIndex"
sortBy="#{column.property}" filterBy="#{column.property}">
<f:facet name="header">
#{column.header}
</f:facet>
#{car[column.property]}
</p:columns>
有关此主题的所有示例和教程仅涵盖简单的 <h:outptText>
嵌套在列中的组件(p:graphicImage,p:commandLink等)怎么样,如上面的代码。
你是如何实现这一目标的?
最佳答案
您可以渲染
您想要做的可能是根据列以不同的方式呈现单元格内容。你可以尝试这样的事情:
//classic rendering (for all cells)
<h:outputText value="#{car[column.property]}"/>
//conditional rendering (for 'report' cells only)
<h:panelGroup rendered="#{column.property == 'report'}">
<p:commandLink id="MRepShowButton" update=":form1:display" onclick="EditorDialog.show();" title="Editer le compte rendu">
<f:setPropertyActionListener value="#{exam}" target="#{dyna.selectedExamen}" />
<p:graphicImage id="img1" value="/images/study_Report_icons/Text/0.png" rendered="#{exam.examen.rapport.rapportWrittenState == null}"/>
<p:graphicImage id="img2" value="/images/study_Report_icons/Text/#{exam.examen.rapport.rapportWrittenState}.png" rendered="#{exam.examen.rapport.rapportWrittenState != null}"/>
</p:commandLink>
</h:panelGroup>
关于java - 如何获取 <p :column> in a facelet using EL 的嵌套组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20789832/