getParent (NotesViewNavigator - JavaScript™)
Returns the parent entry of the current or a specified entry in a view navigator.
Defined in
NotesViewNavigatorSyntax
getParent() : NotesViewEntry
getParent(entry:NotesViewEntry) : NotesViewEntry
Parameter | Description |
---|---|
entry |
An entry in the view. Cannot be null. |
Return value | Description |
---|---|
NotesViewEntry |
The parent entry of the current or specified entry. Returns null if there is no parent entry. |
Usage
This method moves the current pointer to the retrieved entry unless the return value is null.Examples
This button gets all entries in a view in hierarchical order.var nav:NotesViewNavigator = database.getView("By category").createViewNav();
var entry:NotesViewEntry = nav.getFirst();
getentry();
function getentry() { // recursive
if (entry == null) return;
if (entry.isCategory()) {
requestScope.status += "\n" +
entry.getPosition(".") + " " +
entry.getColumnValues().firstElement().toString();
} else if (entry.isDocument()) {
requestScope.status += "\n" +
entry.getPosition(".") + " " +
entry.getColumnValues().elementAt(1).toString();
} else if (entry.isTotal()) {
requestScope.status += "\n" +
entry.getPosition(".") + " " +
entry.getColumnValues().elementAt(3).toString();
}
// try for first child
// if no child, try for next sibling
// if no sibling, go up a level and try for next sibling
var tmpentry:NotesViewEntry = nav.getChild(entry);
if (tmpentry == null) tmpentry = nav.getNextSibling(entry);
if (tmpentry == null) {
tmpentry = nav.getParent(entry);
if (tmpentry != null) tmpentry = nav.getNextSibling(tmpentry);
}
entry.recycle();
entry = tmpentry;
getentry();
return;
}