marouanoviche
marouanoviche

Reputation: 253

how to show loading dialogue while bean method working?

i have a commandbutton that when i click i activate a methode as an action but this action take same time like 10 second. in this time i want to show a dialogue that have as msg loading and to be closed automatiquly when the action is finished. i tryed this like that but doesnt work its apear with last message that confirm that the action is finished well.

in JSF code :

          <p:dialog id="basicDialog4" header="Information" widgetVar="dlg1" visible="#{gestionduplanning.displaydialog4}" style="background-image: none;background-color: #ffffff;">    
            <h:panelGrid columns="1" cellpadding="5" id="pn13236549532">        
               <h:outputText value="Chargement..." style="font-size: 16px;font-family:Times New Roman;" />
           </h:panelGrid>              
          </p:dialog>

<p:commandButton icon="ui-icon-disk" onstart="#{gestionduplanning.chargementstart()}" action="#{gestionduplanning.planificationmanualglobal(gestionduplanning.chefequipedateplanifequipe)}" update="basicDialog2 basicDialog3" />

JSF managed bean :

   public void chargementstart()
   {
   displaydialog4=true;    
   }
   public void chargementstop()
   {
   displaydialog4=false;        
   }

any solution to show the loading dialogue waiting the action finish ??

Upvotes: 0

Views: 2373

Answers (1)

Prasad Kharkar
Prasad Kharkar

Reputation: 13556

You should look into BlockUI compoent which helps to block the UI when ajax request is procesing https://www.primefaces.org/showcase/ui/misc/blockUI.xhtml

Upvotes: 2

Related Questions