Search code examples
jsfexceptionprimefacesblockui

p:commandLink doesn't trigger p:blockUI


I am using PrimeFaces. Here is the code:

<h:form>    
    <p:dataTable...>
        <p:column...>
            <p:commandLink id="featuresLinkId"...>
        </p:column>
    </p:dataTable>
</h:form>

<p:blockUI block=":smForm" trigger="featuresLinkId">
    <p:graphicImage alt="loader image" value="/images/loader.gif"/> 
</p:blockUI>

When the page is being loaded, I see the following error:

javax.servlet.ServletException: 
Cannot find component with identifier "featuresLinkId" in view.

Seems like commandLink can't be used to trigger blockUI in such a scenario. What could the problem be?


Solution

  • Because it won't find that compnent because its inside the form/datatable.

    Make changes as

    1-

    <h:form id="formId">
    

    2-

    <p:dataTable id="tbl">
    

    3-

    <p:blockUI block=":smForm" trigger=":formId:tbl:featuresLinkId">
    

    Try above .