ajax - Dynamically inserted primefaces componenets not rendered properly

Why aren't the Primefaces components rendered properly on partial page update?

The problem is -

I have a view with ui:include -

<ui:include src="#{navBean.viewId}.xhtml}"/>

and p:commandButton -

<p:commandButton action="#{navBean.setViewId('page1')}" value="Load DataTable"/>

and page1.xhtml is where I have a p:dataTable

<ui:composition xmlns ...
    <h:head/>
        <h:form>
            <p:dataTable ...

Now, when I click on the command button, partial update takes place and everything is loaded but the data table is not rendered properly.

Does anybody here know how to get around this problem?

I went through some of the topics in the Primefaces forum but they didn't do any good.

Thank you.

1 Answer

  1. Edwin- Reply

    2019-11-15

    Solution was simple -

    Just include a

    <h:head/>
    

    as follows -

    <ui:composition xmlns ...
        <h:head/>
            <h:form>
                <p:dataTable ...
    

    And now the p:dataTable renders as it is supposed to even on partial page update.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>