gotoPrev (NotesViewNavigator - JavaScript™)
Moves the current pointer to the previous entry of the current or specified entry in a view navigator.
Defined in
NotesViewNavigatorSyntax
gotoPrev() : boolean
gotoPrev(entry:NotesViewEntry) : boolean
Parameter | Description |
---|---|
entry |
An entry in the view. Cannot be null. |
Return value | Description |
---|---|
boolean |
|
Examples
This button gets a view entry by number where 1 is the first entry and -1 is the last entry.var nav:NotesViewNavigator = database.getView("By category and date").createViewNav();
if (nav.getCount() == 0) return;
// User enters a number in the input box bound to requestScope.query
var n:int = parseInt(requestScope.query);
if (isNaN(n) || n == 0) n = 1;
// For positive number, get the nth entry where 1 is the first entry
if (n > 0) {
nav.gotoFirst();
for (var i = 1; i < n; i++) {
nav.gotoNext();
}
// For negative number, get the -nth entry where -1 is the last entry
} else {
nav.gotoLast();
for (var i = -1; i > n; i--) {
nav.gotoPrev();
}
}
entry = nav.getCurrent();
requestScope.status += "\n" + entry.getPosition(".") + " ";
if (entry.isCategory()) {
requestScope.status += entry.getColumnValues().elementAt(entry.getIndentLevel());
} else if (entry.isDocument()) {
requestScope.status += entry.getDocument().getItemValueString("subject");
}