vished2000
vished2000

Reputation: 148

Omnifaces: o:socket with o:commandScript or f:ajax and avoid ajax request

I have the following codes, which are doing the same:

  1. Option1:

    <o:socket channel="notificationChannel" user="#{loginBean.currentEmployee.id}" scope="session" onmessage="notificationLoadScript"> </o:socket> <h:form id="notificationPushTopbarForm"> <o:commandScript name="notificationLoadScript" actionListener="#{topbarMenuController.loadNotification()}" render=":notificationLink" /> </h:form>

  2. Option2

     <h:form>
     <o:socket channel="notificationChannel" scope="session">
         <f:ajax event="notificationLoadScript" listener="#{topbarMenuController.loadNotification()}" render=":notificationLink" disabled="true"/>
     </o:socket>
    

    </h:form>

The code is working fine, but my issue is I have a Primefaces ajaxStatus Dialog which will be invoked....

<p:ajaxStatus onstart="PF('statusDialog').show()"
    onsuccess="PF('statusDialog').hide()">

Is there any possibility to disable in the <o:commandScript or <f:ajax the ajax request, which is possibile in Primefaces with global="false" ?

Many thanks for help

Upvotes: 1

Views: 212

Answers (1)

BalusC
BalusC

Reputation: 1108972

You don't want to avoid an ajax request. You want to avoid the <p:ajaxStatus> being triggered.

Use <p:ajax global="false"> instead of <f:ajax>.

See also its vdldoc:

global

Global ajax requests are listened by ajaxStatus component, setting global to false will not trigger ajaxStatus.

Upvotes: 1

Related Questions