0
votes

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")
1
I may have this working by moving the getComponent line of javascript to the "search" property of the dynamic view panel and prefixing it with "return". But it is not refreshing. So have to work out that partAJF
I now have this refreshing when the button is clicked but it is not filtering with the document Id when I first click on the page and instead returning all contracts that meet the view criteriaAJF

1 Answers

1
votes

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();