ShowTable of Contents
NotesXspViewEntry
This example shows the XML segment for a Repeat control where the data source is a Domino view. An embedded Multiline Edit Box uses the collection name rowdata to return the value of the subject column for each row in the view.
<xp:repeat id="repeat1" rows="30" value="#{view1}" var="rowdata" style="width:725.0px">
<xp:inputTextarea id="inputTextarea1"><xp:this.value><![CDATA[#{javascript:try {
return rowdata.getColumnValue("subject") + "\n"
} catch (e) {
return e.toString();
}}]]></xp:this.value></xp:inputTextarea>
</xp:repeat>
getChildCount getColumnIndentLevel getDescendantCount getIndentLevel getPosition getSiblingCount
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets information about each view row.
try {
return rowdata.getPosition(",").toString() +
" indent level = " + rowdata.getIndentLevel().toFixed() +
" column indent level = " + rowdata.getColumnIndentLevel().toFixed() +
" sibling count = " + rowdata.getSiblingCount().toFixed() +
" child count = " + rowdata.getChildCount().toFixed() +
" descendant count = " + rowdata.getDescendantCount().toFixed() +
"\n"
} catch (e) {
return e.toString();
}
getColumnValue
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets the value of a column.
try {
return rowdata.getColumnValue("subject") + "\n"
} catch (e) {
return e.toString() + "\n";
}
getColumnValues
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets the values of the first two columns. The second column is numeric.
try {
var colvals = rowdata.getColumnValues();
return colvals.elementAt(0) + " " + colvals.elementAt(1).toFixed() + "\n";
} catch (e) {
return e.toString();
}
getDocument
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script gets the value of a document item.
try {
if (rowdata.isDocument()) {
var doc:NotesDocument = rowdata.getDocument();
return doc.getItemValue("subject").elementAt(0);
}
} catch (e) {
return e.toString()
}
getFTSearchScore
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script gets the full-text search score for each view column entry.
try {
if (database.isFTIndexed()) {
return rowdata.getFTSearchScore().toString();
} else {
database.createFTIndex(0, false);
requestScope.status = "FT index created";
return rowdata.getFTSearchScore().toString();
}
} catch (e) {
return e.toString()
}
getJavaColumnValues
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets the values of columns depending on whether they are categories, totals, or documents.
try {
if (rowdata.isCategory()) {
return rowdata.getPosition(",") + " = " + rowdata.getJavaColumnValues().elementAt(0) + "\n"
} else if(rowdata.isTotal()) {
return rowdata.getPosition(",") + " = " + rowdata.getJavaColumnValues().elementAt(2).toString() + "\n"
} else if (rowdata.isDocument()) {
return rowdata.getPosition(",") + " = " + rowdata.getJavaColumnValues().elementAt(1) + "\n"
}
} catch (e) {
return e.toString();
}
getNavigatorPosition
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets a column value depending on whether the entry is a category, total, or document, and returns the position plus the value.
try {
if (rowdata.isCategory()) {
return rowdata.getNavigatorPosition() + " = " + rowdata.getColumnValue("category") + "\n"
} else if(rowdata.isTotal()) {
return rowdata.getNavigatorPosition() + " = " + rowdata.getColumnValue("number").toString() + "\n"
} else if (rowdata.isDocument()) {
return rowdata.getNavigatorPosition() + " = " + rowdata.getColumnValue("subject") + "\n"
}
} catch (e) {
return e.toString();
}
getNoteID
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script gets the value of a document item.
try {
if (rowdata.isDocument()) {
var doc:NotesDocument = database.getDocumentByID(rowdata.getNoteID());
return doc.getItemValue("subject").elementAt(0);
}
} catch (e) {
return e.toString()
}
getOpenPageURL
This onclick script for a Button control is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script opens a document in read mode.
context.redirectToPage(rowdata.getOpenPageURL("documentread", true))
getRead
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script determines if the current user has read a document.
try {
if (rowdata.isDocument()) {
if (rowdata.getRead()) {
return session.getCommonUserName() + " has read this";
} else {
return session.getCommonUserName() + " has not read this";
}
}
} catch (e) {
return e.toString()
}
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script determines if a specified user has read a document.
try {
if (rowdata.isDocument()) {
if (rowdata.getRead(sessionScope.username)) {
return sessionScope.username + " has read this";
} else {
return sessionScope.username + " has not read this";
}
}
} catch (e) {
return e.toString()
}
getUniversalID
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script gets the value of a document item.
try {
if (rowdata.isDocument()) {
var doc:NotesDocument = database.getDocumentByUNID(rowdata.getUniversalID());
return doc.getItemValue("subject").elementAt(0);
}
} catch (e) {
return e.toString()
}
This XML for a Button control is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The button uses a script get the ID of the document to be accessed by an Open Page simple action.
<xp:button id="button1" value="open"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:openPage name="/documentread.xsp" target="openDocument"
documentId="#{javascript:database.getDocumentByUNID(rowdata.getUniversalID())}">
</xp:openPage>
</xp:this.action></xp:eventHandler></xp:button>
isCategory isDocument isTotal
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets a column value depending on whether the entry is a category, total, or document.
try {
if (rowdata.isCategory()) {
return "Category = " + rowdata.getColumnValue("category") + "\n"
} else if(rowdata.isTotal()) {
return "Total = " + rowdata.getColumnValue("number").toFixed() + "\n"
} else if (rowdata.isDocument()) {
return " Subject = " + rowdata.getColumnValue("subject") + "\n"
}
} catch (e) {
return e.toString();
}
isConflict
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script displays text if a view entry is for a conflict document.
try {
if (rowdata.isConflict()) {
return "CONFLICT DOCUMENT!"
}
} catch (e) {
return e.toString()
}
isExpanded setExpanded
This is the XML for a Button control embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The button has a script to hide it if the row has no descendants. Another script sets the button label to "Expand“ or "Collapse“ depending on the state of the current row. Finally the onclick event for the button toggles the state of the current row.
<xp:button id="button1">
<xp:this.rendered><![CDATA[#{javascript:rowdata.getDescendantCount() > 0}]]></xp:this.rendered>
<xp:this.value><![CDATA[#{javascript:if (rowdata.isExpanded()) {
return "Collapse"
} else {
return "Expand"
}}]]></xp:this.value>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:rowdata.toggleExpanded()}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
This example is the same as the first but exercises setExpanded.
<xp:button id="button1">
<xp:this.rendered><![CDATA[#{javascript:rowdata.getDescendantCount() > 0}]]></xp:this.rendered>
<xp:this.value><![CDATA[#{javascript:if (rowdata.isExpanded()) {
return "Collapse"
} else {
return "Expand"
}}]]></xp:this.value>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:if (rowdata.isExpanded()) {
rowdata.setExpanded(false)
} else {
rowdata.setExpanded(true)
}}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
isPreferJavaDates setPreferJavaDates
This onclick script for a Button control is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script toggles the preference for Java dates for a view entry.
try {
if (rowdata.isPreferJavaDates()) {
rowdata.setPreferJavaDates(false)
} else {
rowdata.setPreferJavaDates(true)
}
} catch (e) {
requestScope.status = e.toString()
}
isSelected setSelected
This onclick script for a Button control is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script toggles the selection mode for a view entry.
try {
if (rowdata.isSelected()) {
rowdata.setSelected(false)
} else {
rowdata.setSelected(true)
}
requestScope.status = "row selection changed to " + rowdata.isSelected();
} catch (e) {
requestScope.status = e.toString()
}
isValid
This value script for a Computed Field is embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The script displays text if a view entry is for a deletion stub.
try {
if (!rowdata.isValid()) {
return "DELETION STUB!"
}
} catch (e) {
return e.toString()
}
toggleExpanded
This is the XML for a Button control embedded in a Data Table control with a Domino view data source whose collection name is rowdata. The button has a script to hide it if the row has no descendants. Another script sets the button label to "Expand“ or "Collapse“ depending on the state of the current row. Finally the onclick event for the button toggles the state of the current row.
<xp:button id="button1">
<xp:this.rendered><![CDATA[#{javascript:rowdata.getDescendantCount() > 0}]]></xp:this.rendered>
<xp:this.value><![CDATA[#{javascript:if (rowdata.isExpanded()) {
return "Collapse"
} else {
return "Expand"
}}]]></xp:this.value>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:rowdata.toggleExpanded()}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
toString
This data binding script for a Multiline Edit Box is embedded in a Repeat control with a Domino view data source whose collection name is rowdata. The script gets a string representation of each column view entry.
try {
if (rowdata.isCategory()) {
return rowdata.toString()
} catch (e) {
return e.toString();
}