如何获取< p:column>的嵌套组件?在使用EL的小面孔中 [英] How can I get the nested components of a <p:column> in a facelet using EL
本文介绍了如何获取< p:column>的嵌套组件?在使用EL的小面孔中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有这个:
<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> <实现这一目标/ code>
Now how can I achieve that using the <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等等)嵌套在如上代码的列中。
你是如何实现的?
all the examples and tutorials about this topic only covers the simple <h:outptText>
what about components (p:graphicImage,p:commandLink ,etc..) nested in a column like the code above.
how do you achieve that ?
推荐答案
你可以渲染< p:columns>内的任何元素。元素。
You can render any element inside the <p:columns> element.
您要做的事情可能是以不同方式呈现单元格内容,具体取决于列。您可以尝试这样的事情:
What you want to do is probably render the cell contents differently, depending on the column. You can try something like this :
//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>
这篇关于如何获取< p:column>的嵌套组件?在使用EL的小面孔中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文