Partial Page Rendering in XPages
More goodness coming along in XPages 8.5.2 (Disclaimer: it is still Beta ...) An XPage is a collection, or to be precise, a tree of controls with an xp:view tag as root control. The xp:view tag translates into a instance of the UIViewRootEx2 class. In theory you could subclass this but then you stray far away from the path of IBM support. In some case (think Ajax updates) it would be nice if you could request the render result of just one control (and all its children of course). In 852 this is possible using the
The control doesn't need to check for the value of [SomeactionName], it is up to you if you want to use that. A sample function giving you the url for a given command and control could look like this (you want to add error handling for production use):
As usual YMMV
?$$axtarget=
directive. It takes the client id as parameter and requires a keyword (you can use to identify the action) between page name and directive. So your URL could look like this:
http(s)://[yourserver]/[application.nsf]/[Yourpage.xsp]/[SomeactionName]?$$axtarget=[ClientIDofTheControl]
The control doesn't need to check for the value of [SomeactionName], it is up to you if you want to use that. A sample function giving you the url for a given command and control could look like this (you want to add error handling for production use):
-
function getSpecialAction (actionName , componentName ) {
-
var toRenderPartial = getComponent (componentName ) ;
-
return 'myPage.xsp/' +actionName + '?$$axtarget=' +toRenderPartial. getClientId (facesContext ) ;
-
}
Posted by Stephan H Wissel on 25 June 2010 | Comments (6) | categories: XPages