gotoChild (NotesViewNavigator - JavaScript)

Moves the current pointer to the first child of the current or specified entry in a view navigator.

Defined in

NotesViewNavigator

Syntax

gotoChild() : boolean

gotoChild(entry:NotesViewEntry) : boolean

Parameter Description
entry An entry in the view. Cannot be null.
Return value Description
boolean
  • true if the operation succeeds
  • false if there are no children

Usage

A child of a category entry can be a category or document entry.

Examples

This button positions a view navigator according to user input of a decimal form that designates level and sequence number. For example, 2.5.1 means go to the second entry, drop one level, go to the fifth entry, drop a level, and go to the first entry.
var nav:NotesViewNavigator = database.getView("By category and date").createViewNav();
var entry:NotesViewEntry = null;
var firstTime = true;
var position:string = requestScope.query;
if (position.isEmpty()) {
	requestScope.status += "\nNo position";
	return;
}
var p:int = 0;
var n:int = 0;
var i:int = 0;
// Expecting position of form p.p ... .p
// Each iteration processes one p
while (!position.isEmpty()) {
	// Parse position and verify as number
	n = position.indexOf(".");
	if (n > -1) {
		p = parseInt(position.left(n));
		position = position.right(position.length - n -1);
	} else {
		p = parseInt(position);
		position = "";
	}
	if (isNaN(p)) {
		requestScope.status += "\nInvalid number";
		return;
	}
	// Go to the first entry for the level being processed
	if (!firstTime) {
		if (!nav.gotoChild()) {
			requestScope.status += "\nInvalid position";
			return;
		}
	} else {
		if (!nav.gotoFirst()) {
			requestScope.status += "\nView empty";
			return;
		}
		firstTime = false;
	}
	// Go to entry # p on the level being processed
	for (var i=1; i<(p); i++) {
		if (!nav.gotoNextSibling()) {
			requestScope.status += "\nInvalid position";
			return;
		}
	}
}
// Get the entry
entry = nav.getCurrent();
requestScope.status += "\n" + entry.getPosition(".") + " ";
requestScope.status += entry.getColumnValues().elementAt(entry.getIndentLevel());