gotoPrevSibling (NotesViewNavigator - JavaScript™)
Moves the current pointer to the previous sibling entry of the current or specified entry in a view navigator.
Defined in
NotesViewNavigatorSyntax
gotoPrevSibling() : boolean
gotoPrevSibling(entry:NotesViewEntry) : boolean
Parameter | Description |
---|---|
entry |
An entry in the view. Cannot be null. |
Return value | Description |
---|---|
boolean |
|
Examples
This button gets a level-1 category view entry by number where 1 is the first level-1 category entry and -1 is the last level-1 category entry.// This view has categories and ends with a total
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 level-1 category where 1 is the first category
if (n > 0) {
nav.gotoFirst();
for (var i = 1; i < n; i++) {
nav.gotoNextSibling();
}
// For negative number, get the -nth level-1 category where -1 is the last category
} else {
nav.gotoLast();
nav.gotoPrevSibling();
for (var i = -1; i > n; i--) {
nav.gotoPrevSibling();
}
}
entry = nav.getCurrent();
if (entry.isTotal()) entry = nav.getPrevSibling();
requestScope.status += "\n" + entry.getPosition(".") + " ";
requestScope.status += entry.getColumnValues().elementAt(entry.getIndentLevel());