What I am trying to do is have an edit box, a button and a dynamic view panel on an Xpage and a View in the Notes database. Then input a document Id in the edit box which, when the button is clicked will use the edit box value as a parameter for filtering in the dynamic view panel. There seems to be very little on the Internet. I have tried setting the dynamic view panel's "Keys" property to the value
getComponent("inputDocumentID").getValue()
And have the button do a full refresh but this does not work. How can I use the edit box as the dynamic views parameter? The Notes View selection formula is;
SELECT ((Form = "Contract")) & (conContractStatus = "Cancelled") &
(initialstagecomplete = "1")
I usually do this using scoped variables. The idea is to use a mechanism similar to LotusScript's NotesViewEntryCollection.getEntriesByKey("keyFilter", False)
:
Let's assume you have a Notes view where the first column is sorted by UNID (column formula = @Text(@DocumentUniqueID)
).
Inside your xpage you create your view panel as always. The vp's key property is set to listen to a requestScope variable like this:
<xp:viewPanel id="viewPanel1">
<xp:this.data>
<xp:dominoView var="view1" viewName="myView"
keys="#{javascript:requestScope.keyFilter;}">
</xp:dominoView>
</xp:this.data>
...
</xp:viewPanel>
Somewhere else on the Xpage you create an editbox and bind it to your requestScope var like this:
<xp:inputText id="inputText1" value="#{requestScope.keyFilter}">
<xp:eventHandler event="onkeyup" submit="true"
refreshMode="partial" refreshId="viewPanel1">
</xp:eventHandler>
</xp:inputText>
As you see every input is immediately stored in my scope variable, and every keyup event performs a partial refresh on the view panel thus refining the key filter as I type.
Remark:
There's a caveat in case your view panel comes with a pager: if you start filtering while your vp isn't showing page #5 applying a key filter could render an empty view. Reason is that the view still is showing page #5 but there just isn't enough data left to show on 5 pages.
Solution again is quite simple: add a few lines of server side script to your edit box's onkeyup
event thus resetting the view to show page #1:
getComponent("viewPanel1").gotoFirstPage();