Mar 15, 2016, 9:05 AM
178 Posts

unique URL

  • Category: Other
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags: view,navigation
  • Replies: 3

in case you need to create unique URL's (e.g. for bookmarking) you could find the current document in the view and use the getPrevDocument / getNextDocument method

 

                <xp:link escape="true" text="Previous" id="link4"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
    <xp:this.action>
        <xp:openPage name="/peopleDoc.xsp" target="openDocument">

            <xp:this.documentId><![CDATA[#{javascript:var v:NotesView = database.getView("People");
var doc:NotesDocument = v.getDocumentByKey(person.getDocument().getUniversalID());
if (doc == null) {
    return;
}
else{
    var tmpdoc = v.getPrevDocument(doc);
    doc.recycle();
    doc = tmpdoc;
    return doc.getUniversalID();
}}]]></xp:this.documentId>
        </xp:openPage>
    </xp:this.action></xp:eventHandler></xp:link>

 

In this example the first sorted column is the view contains the document unique id but of course you can create your own "unique key" e.g. firstname + lastname