1

I am sending multiple ajax request in PrimeFaces. I have used <p:ajaxStatus /> component to show loading dialog. I am performing CRUD operation in PrimeFaces. So all CRUD operations are using ajax request. So whenever i am performing any CRUD operation loading dialog is shown. Where as i just want to show Loading dialog only for DELETE operation.

So is there any way that i can prevent ajax status for a particular request?

0x5a4d
  • 750
  • 1
  • 7
  • 21
TechChain
  • 8,404
  • 29
  • 103
  • 228
  • Use either [``](http://www.primefaces.org/showcase/ui/misc/blockUI.xhtml) or [``](http://www.primefaces.org/showcase-ext/sections/blockui/blockUIAjax.jsf). I choose the latter. – Tiny Apr 12 '15 at 13:20

1 Answers1

3

Think the other way around…

"How can I show a dialog when a command starts and hide it when it end"

The answer is very simple then. Use the onstart and oncomplete attributes of the single commandbutton to show/hide a specific dialog. You can customize that one specific dialog in any way you want.

You can also use a p:blockUI as correctly stated in the comments

The ajaxstatus is a kind of optimization if you want it for all requests. In this case you want it for one request. So don't use the onstart and oncomplete of an ajaxstatus then.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • I am using Ajax Status.How to customize ajax status? – TechChain Apr 12 '15 at 13:00
  • The ajax status is a kind of optimization if you want it for all requests. In this case you want it for one request. Then the answer above is a very good way to go. You can customize that one specific ldialog in any way you want – Kukeltje Apr 12 '15 at 13:03
  • How to do for single request.Previously i was calling javasctipt function onComplete & onStart – TechChain Apr 12 '15 at 13:05
  • What single request? You want it on one delete but not on the next. And I edited my answer to explain in a little more detail – Kukeltje Apr 12 '15 at 13:09
  • No i want to show loading bar only for delete request not for edit. So how can i use ajax status in that case – TechChain Apr 12 '15 at 13:13
  • DON'T… Read my answer again, I 'optimized' it by combining it with a comment I made – Kukeltje Apr 12 '15 at 13:16