Skip to main content link. Accesskey S

XPages Wiki

Submit Search

YouAtNotes XPages Wiki


Home > Server JavaScript > Work with events and partial or full refresh

Work with events and partial or full refresh

ShowTable of Contents

Run a partial update from client javascript


 
You can use the following function to trigger a partial update from client javascript

 
XSP.partialRefreshPost(id);

 
"id" is the runtime ID of the control, that means you have to get it with "#{id:nameOfControl}".

If you don't need to be any field changes to be considered by the update, then you can use

 
XSP.partialRefreshGet(id);


which does a "HTTP GET" and produces slightly less network traffic.

Run multiple partial updates


Found by Tim Tripcony.

In the Domino Designer UI you can only set one ID as target for a partial update.
But together with the XSP.partialRefreshPost() or XSP.partialRefreshGet() functions you can chain multiple updates like this:

XSP.partialRefreshGet(id1, {
  onComplete: function() {
    XSP.partialRefreshGet(id2, {
      onComplete: function() { XSP.partialRefreshGet(id3); }
    } 
 }
}


the second parameter for the XSP.partialRefreshXXX can be a javascript object which defines functions for:

- onStart (executed before the partial update starts)
- onComplete (executed after the partial update)
- onError (executed when there was an error during the update)
 
So, you can do something like this:

XSP.partialRefreshGet(id, |
  onStart: function() { doSomething; },
  onComplete: function() { doSomething; },
  onError: function() { doSomething; }
}



Hijack partial refresh events in client javascript


Tommy Valand found a cool method to execute custom javascript on partial refresh events.

In a nutshell:

1.) place a script like this at the very top of your page:

function hijackAndPublishPartialRefresh(){
// Hijack the partial refresh
XSP._inheritedPartialRefresh = XSP._partialRefresh;
XSP._partialRefresh = function( method, form, refreshId, options ){ 
// Publish init
dojo.publish( 'partialrefresh-init', [ method, form, refreshId, options ]);
this._inheritedPartialRefresh( method, form, refreshId, options );
}

// Publish start, complete and error states 
dojo.subscribe( 'partialrefresh-init', function( method, form, 
refreshId, options ){
if( options ){
options.onStart = function(){
dojo.publish( 'partialrefresh-start', [method, form, refreshId, options]);
};

options.onComplete = function(){
dojo.publish( 'partialrefresh-complete', 
[method, form, refreshId, options]);
};
options.onError = function(){
dojo.publish( 'partialrefresh-error', [ method, form, refreshId, options]);
};
}
});
}


2.) use it like this:

dojo.subscribe( 'partialrefresh-init', null, function( method, form, refreshId ){
alert('Partial refresh for ' + refreshId + ' initiated.' );
} );

dojo.subscribe( 'partialrefresh-start', null, function( method, form, refreshId ){
alert('Partial refresh for ' + refreshId + ' started.' );
} );

dojo.subscribe( 'partialrefresh-complete', null, function( method, form, refreshId ){
alert('Partial refresh for ' + refreshId + ' complete.' );
} );

dojo.subscribe( 'partialrefresh-error', null, function( method, form, refreshId ){
alert('An error occured during partial refresh of ' + refreshId + '.' );
} );

Historical: fix for partial refresh bug in Domino 850 with Firefox 35 and other browsers


Hector Amato found a fix for the "_10f is not a function" message when using partial refresh with Domino 8.5.0 and Firefox 3.5, Opera and other browsers:

Edit this file: data/domino/js/dojo-1.1.1/ibm/xsp/widget/layout/xspClientDojo.js

Note: this file does not contain any whitespace and is hard to read. Search for "var _10f" and find the statement "var _10f=dojo.query("script", node);".
Add this after the semicolon:

if (!_10f.push)_10f=dojo._filterQueryResult(_10f);


So that the result is

var _10f=dojo.query("script", node);if (!_10f.push)_10f=dojo._filterQueryResult(_10f);


See also Hector's post in the Notes forum: http://www-10.lotus.com/ldd/nd85forum.nsf/ShowMyTopicsAllFlatweb/0d454c8cae2fc4408525762a0034cfa8?OpenDocument
See what's possible with Xpages.
Have a look at our ServiceCommunicator website
and the YouAtNotes Support.
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this wiki help you?
Did this saved you time? Express your gratitude by making a donation:
PayPal - The safer, easier way to pay online!