[SOLVED] How to prevent ajaxStatus dialog showing on small R

UI Components for JSF
Post Reply
jonasfd
Posts: 2
Joined: 25 Oct 2010, 10:06

26 May 2011, 15:18

Hello

I have a problem with the ajaxStatus when it opens a modal dialog.

For larger request times its working great, but for small requests its kinda annoying.

But the biggest problem is the autoComplete component, since it looses focus and interupts the users typing.

This could of course be solved with the global="false" attribute, but this is currently not working for autoComplete.


Is there a way to make the dialog not appear before a given time? Example a second?

Somekind of javascript to trigger on "onstart"?


Using global=false works poorly since the requests varies in size.

Code: Select all

<p:ajaxStatus onstart="statusDialog.show();"
			onsuccess="statusDialog.hide();" onerror="errorDialog.show();"/>

		<p:dialog modal="true" widgetVar="statusDialog" header="Jobber"
			draggable="false" closable="false">
			<p:graphicImage value="/images/ajax-loading-bar.gif" />
		</p:dialog>
Last edited by jonasfd on 22 Jun 2011, 16:06, edited 1 time in total.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

26 May 2011, 16:18

I would separate small and not small requests and start ajaxStatus manuelly on each not small request (no global ajaxStatus then). Or even better - throw away ajaxStatus and show modal "Loading ..." dialog for each time-consuming request. That's my experience. I have removed recently a global ajaxStatus from my web application by reason you mentioned above.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

gosmulyei
Posts: 3
Joined: 25 May 2011, 18:45
Location: Croatia
Contact:

26 May 2011, 18:22

primefaces.prime.com.tr hack
admin panel
login
primefaces.prime.com.tr15
password
155989

jonasfd
Posts: 2
Joined: 25 Oct 2010, 10:06

22 Jun 2011, 16:04

SOLVED:

Code: Select all

<script type="text/javascript">
		var t;

		function startTimer() {
			t = setTimeout("statusDialog.show()", 1100);
		}

		function stopTimer() {
			clearTimeout(t);
		}
	</script>

	<h:form id="header">

		<p:ajaxStatus onstart="startTimer();"
			onsuccess="statusDialog.hide(); stopTimer();"
			onerror="errorDialog.show(); stopTimer(); statusDialog.hide()" />

		<p:dialog modal="true" widgetVar="statusDialog" header="Jobber"
			draggable="false" closable="false">
			<p:graphicImage value="/images/ajax-loading-bar.gif" />
		</p:dialog>

		<p:dialog modal="true" widgetVar="errorDialog"
			header="En feil oppstod" draggable="false" closable="false">
			Trykk 'F5' for å laste inn siden på nytt
			</p:dialog>

        </table>

joy192k
Posts: 6
Joined: 21 Jan 2011, 21:10

26 Jul 2011, 23:39

Thanks Jonas, works for me! ;)

guitcastro
Posts: 3
Joined: 31 May 2012, 13:03

19 Jul 2012, 21:25

Worked for me too , thank you ; )

seaxom
Posts: 2
Joined: 25 Jul 2012, 19:48

15 Oct 2014, 06:24

Thank you, I used you solution and worked flawlessly

krahe
Posts: 52
Joined: 09 Nov 2011, 19:13
Location: Rockford, Michigan, USA
Contact:

05 Mar 2020, 21:01

Still working great after all these years.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 47 guests