This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 21, 2011, 2:06 PM
30 Posts
topic has been resolvedResolved

Fetching an entire page with AJAX?

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: AJAX
  • Replies: 4
 in a placeholder I have a view, actually it's a repeat but who cares, anywho.. This "view" contains links to open a corresponding document.
 
With JS I prevent the default behavior of the link and want to fetch a page thru AJAX instead, replacing the content of the same placeholder. Eg, emulating a good(?) old frameset.
 
 
What I can't quite get my head around is if, and how, I can return an entire XPage thru AJAX. Or do I have to build and return the HTML myself? 
 
If I do a simple Open Page with a partial update set, it still performs a full update and opens the entire page and NOT inside the panel I selected for the partial update.
 
 
 
Thanks! 
 
 
/J 
Mar 21, 2011, 2:50 PM
21 Posts
Re: Fetching an entire page with AJAX?
There's probably several ways to do this, but this is the approach I'd try:
Create a viewPanel that is to be your frame.
a) inside the viewPanel, add two <xp:include> tags.
b) The first one will be your view.xsp, and has a rendered property dependant on a sessionScope variable displayView==true.  On the view xpage, the entry onclick will set a sessionScopeVariable docId, and set the displayView=false.  refresh viewpanel.
c) The 2nd will be your document.xsp, and also has a rendered property dependant on displayView==false.  The document xpage will have a docid dependant on docId.
 
So when you click on your view entry, it disappears and the document takes it's place.  You'll need some sort of button or event to close the document and redisplay the view, but the logic is the same.

Mar 21, 2011, 5:29 PM
30 Posts
Re: Fetching an entire page with AJAX?
 Great! You understood what I was after despite my "less then" perfect explanation..
 
Yes, this was one of my attempts. But I can't get the xp:include to open a document.
 
I CAN get it to open/include another XPage: 
<xp:include pageName="article.xsp" id="include1"></xp:include> 
 
But THIS wont work: 
<xp:include pageName="article.xsp?documentId=0949E47BB5812476412578550050B853&amp;action=openDocument" id="include1"></xp:include> 
 
However this URL is valid: 
article.xsp?documentId=0949E47BB5812476412578550050B853&action=openDocument
 
 
I just assumed that you only were allowed to include XPages and not documents this way? 
 
Or am I missing something vital? 
 
 
Thanks! 
 
/J 
Mar 22, 2011, 8:31 AM
21 Posts
Re: Fetching an entire page with AJAX?
That's what the docId sessionScope variable was for -
on the document xpage, you set the documentId to the docId you saved before, like so:
<xp:this.data>
        <xp:dominoDocument var="document1" action="openDocument"
            documentId="#{javascript:sessionScope.docId}">
        </xp:dominoDocument>
    </xp:this.data>
 
 
Mar 22, 2011, 9:11 AM
30 Posts
Re: Fetching an entire page with AJAX?
 Excellent! Got It!
 
 
Thanks! 
 
/J 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal