1251

Where should I use XSP.endAjaxLoading()?

Question:

I have a Xpage that takes too long to load. So the client ask me to do a loading indicator. I searched and found XSP.startAjaxLoading(), that I put in onClientLoad event of the Custom Control. But now I don't know where should I put XSP.endAjaxLoading() to make the loading screen go away. I'tried to use in afterRenderResponse and beforeRenderResponse: view.postScript("XSP.endAjaxLoading()"), since this comand is CSJS, but it doesn't work.

Thanks in advance.

Answer1:

I think you want to put it in the onComplete event. That can be difficult to find. You typically need to use the outline control to find it.

I have a video demo on NotesIn9 that has an example on this.

<a href="http://www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/?unique=http%3A//www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/" rel="nofollow">http://www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/?unique=http%3A//www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/</a>

Answer2:

Your attempt (view.postscript) works only with full/partial updates and does not work for page loading.

You have used onClientLoad - which is executed when your page is finished with loading. I guess you get ajax animation after a while and it won't stop.

You should make preload screen - very simple XPage which starts animation and does not care to turn it off. In onClientLoad event redirect to your slow XPage. That will discard the animation.

Answer3:

I'd highly recommend using the Standby Dialog XSnippet <a href="https://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control" rel="nofollow">https://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control</a>. I use it as a standard in all XPages applications.

Answer4:

I used this answer as solution: <a href="https://stackoverflow.com/a/35481981/5339322" rel="nofollow">https://stackoverflow.com/a/35481981/5339322</a><br /> I've saw it a few days ago, what made me think twice is that using this i should know what is doing my XPages to delay. I ran some tests and discovered what, and it was a call to a method in the afterRestoreView event, then I migrated it to onClientLoad event and used the solution in the answer above cited. But I'm afraid that I have to keep an eye on it, so if someone adds some code that delays in one of the another events of XPages I have to move it again, of course, if it's possible, if it's not, I'll figure it out something diferent.

Thanks for all the answers ans comments.

Recommend

  • autosave function Ajax Mode - second part
  • Build Automatically versus Build Manually
  • I want to bind the click event to the li elements in the xpages type-ahead
  • How do I access SQL from XPages
  • Paramiko SSHException Channel Closed
  • Parallel sieve of Eratosthenes - Java Multithreading
  • Cannot invoke my method on the array type int[]
  • Outlines on links in IE9 remains when focus is changed
  • Multiple producers single consumer locking schema
  • How do I include a SWC in an AS2 Flash project?
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • How to add a focus style to an editable ComboBox in WPF
  • Code in Job's Script Block after Start-Process Does not Execute
  • How do I superscript characters in a UIButton?
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • Handling un-mapped Rest path
  • FFmpeg Conversion Error
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • Control modification in presentation layer
  • Javascript simulate pressing enter in input box
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • Optimizing database types to compact database (SQLite)
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Obtain ObjectIdHex value from mgo query
  • Cross-Platform Protobuf Serialization
  • How to check if every primary key value is being referenced as foreign key in another table
  • ILMerge & Keep Assembly Name
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Do I've to free mysql result after storing it?
  • Why winpcap requires both .lib and .dll to run?
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Acquiring multiple attributes from .xml file in c#
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • JaxB to read class hierarchy
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?