Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show ajaxstatus for dynamic Primefaces components
    primarykey
    data
    text
    <p>I have noticed that pretty much all PF components that have 'dynamic' attribute set to 'true' will only show up after a short delay (which is understandable), and also will not trigger ajax start/stop event.</p> <p>This is my (perfectly working) Ajax status component, actual dialog contents omitted for brevity:</p> <pre><code>&lt;p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();" onerror="errorDialog.show();"/&gt; </code></pre> <p>This is a dynamically loaded dialog. It needs to get data from backing beans:</p> <pre><code>&lt;p:dialog modal="true" widgetVar="confDialog" position="center" id="confD" dynamic="true"&gt; &lt;p:panelGrid&gt; &lt;p:row&gt; &lt;p:column&gt; &lt;h:outputText value="Date"&gt;&lt;/h:outputText&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;h:outputText value="#{myBean.currentDate}"&gt; &lt;f:convertDateTime locale="#{myBean.currentLanguage}" type="both" dateStyle="full" timeStyle="full" timeZone="#{myBean.currentTimeZone}"&gt;&lt;/f:convertDateTime&gt; &lt;/h:outputText&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;/p:panelGrid&gt; &lt;p:commandButton value="Close" type="button" onclick="confDialog.hide();"&gt; &lt;/p:commandButton&gt; &lt;/p:dialog&gt; </code></pre> <p>A commandbutton that does something and displays dynamically loaded confirmation dialog:</p> <pre><code>&lt;p:commandButton value="Do it" type="submit" ajax="true" process="@form" action="#{bean.processForm}" oncomplete="if(!args.validationFailed){confDialog.show();}" update="confD @form"/&gt; </code></pre> <p>Ajax status dialog is displayed while the commandbutton submits the data to backing bean and gets data back. Then ajax status dialog disappears, there is a delay of 1-2 seconds, and confirmation dialog is shown.</p> <p>The same happens with dynamically loaded tabs (in PF tabView component).</p> <p>Why isn't my ajax status dialog displayed during dynamic component load? How can I show it?</p> <p>EDIT: </p> <p>thanks to @partlov I figured out a solution without overriding PF function, by adding JQ ajax start/stop handler to the dynamically loaded dialog:</p> <pre><code>jQuery(document).ready(function() { confDialog.getJQ().ajaxStart(function(){statusDialog.show()}); confDialog.getJQ().ajaxStop(function(){statusDialog.hide()}); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload