Tag Archives: Partial Refresh

Holiday Hack: Get some XPage power in old Notes apps

UPDATE: Post with fully working example with serverside redirects working

One of the great things with XPages is the partial refresh that help you to update information inside the page without a full reload of the page. Well that is not possible with older notes applications because it does a full roundtrip to the server each time we change something. But we can update the screen without the users notice it with ajax. What I did was create a copy of the main js function that Domino uses _doClick and replace that with my own copy of that function in onload.

function onloadAjax(){

  window._doClickNew=window._doClick

  window._doClick=window.newDoClick

}

I store the original function within _doClickNew that is the great thing in this case with javascript. Everything is an object including functions and I can place myself before the original function. My function will now be called when something happens on the Domino form. There is two types of events on a old school Domino form. There is a refresh post and a full post, the script detects if you are trying to do a refresh post and convert that into a ajax request. You can also add entries to an Javascript array PartialRefreshArray by pushing new entries PartialRefreshArray.push(“mybutton”) if you then add a button to the form with the id mybutton it will also be ajax refreshed.

But there are some down sides to this functionality, we can’t use server side redirects. When the form is posted the referer is used when returning data, and because we have ajax refreshed the form the url isn’t updated correctly if we have created the document using the following url

server/database/form?openform

What we need to do is to create the document before we open it the first time and load the document using

server/database/view/UNID?editDocument

If that is used the code can imitate partial refresh, but remember no server side redirects can be used, webquerysave agent runs but not the redirect, so if you want to move away from the form you need to use client side JS.

I’ve created a simple database to show the functionality that you can download here 

disk

Conclusion, the partial refresh behaviour can be added but then you need to hack any redirects done using agents and you need to pre create the document and have a scheduled agent to delete the forms not saved.

This is only an hack example not any production code, and may stop working if IBM changes anything.

 

Standby Custom control what does it do

I have added my first XSnippet today and it’s the Standby custom control.
If you add the code to a custom control and drag in into an XPage all events done in this XPage will be intercepted and if the event taks more than 200 milli seconds the dojo standby widget will show up and prevent the user from clicking.

 

http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control 

 

Some of the code were originally created by two great XPage guys
Tommy Valand and Serdar Başeğmez 

Get a progressbar everytime a partialrefresh is fired

I was looking for some code today to get a wait sign when a partial refresh had fired. I found this great article at lotusnotus.com bu that wait sign had to be added to each event (Not my kind of thing 😉 ).

Then I remembered that I saw some code created by Tommy Valand to hijack all partial refresh events.

So I made a cut and paste coding and volia. Standby wait sign every time a partialrefresh fires.

I added code section one and two above and also this section into a scriptlibrary.

You could add this lib to a custom control and add the hijackAndPublishPartialRefresh() function in the onclientload client event. Also add dojox.widget.Standby as a dojo module resource.

When I started to use this I found that it was firing all the time, and I didn’t want that so I did some modifications

You’ll still need the hijack script and this last script.

Enjoy!!

Update, Latest version of this can be found here
using the designer import tool –> Link

Or XSnippet