how to add component programmatically/dynamically to a p:dataTable facet

家住魔仙堡 提交于 2019-12-01 14:03:03

Like in normal XHTML/Facelets code, a <f:facet> can have only one child.

This, as indicated in your code comment,

<f:facet name="header" >  
    <h:outputText value="Rechercher:  "/>  
    <p:inputText id="globalFilter" onkeyup="examTable.filter();" style="width:200px" /> 
</f:facet> 

is already invalid. It wouldn't have worked in Facelets either. You need to wrap it in a <h:panelGroup>.

<f:facet name="header" >  
    <h:panelGroup>
        <h:outputText value="Rechercher:  "/>  
        <p:inputText id="globalFilter" onkeyup="examTable.filter();" style="width:200px" /> 
    </h:panelGroup>
</f:facet> 

Just do the same in Java code. Remember: there's nothing which can only be done in Java code and not in XHTML, or vice versa. Everything which is possible in Java is also possible using pure XHTML (unlike JSP). Only difference is that XHTML is generally much less verbose and more maintenance friendly in this area.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!