0
votes

I'm converting an old Notes app to xpages and ran into a problem. The app is a sort of bookmark app. A user selects a 'bookmark' button and I store the doc's db and unid dbs in a document in this bookmark db. When the doc is created, a redirect is created so when the bookmark doc is opened, it automatically launches the doc that was bookmarked.

It works fine with a regular Notes view but I want to replace the Notes view with a xapge containing a view control. So I created a xpage view and linked one of the columns. How do I get a handle on the selected/clicked-on document. If I can get to that, it'll be easy to redirect the page to the intended document.

I tried the column's onclick event to get 'currentDocument' but it doesn't look like it's available there. Any other ideas?

thanks
Clem

2

2 Answers

0
votes

Format your first column as checkbox and then you can use

getComponent("view1").getSelectedIds()

to get a handle in the selected documents

0
votes

Have you thought about using a repeat control for this? I think it might be easier and provide some better functionality with a repeat.

So lets say you have a simple repeat. Inside the repeat put a table (put the first row outside the repeat). and then use an event on the second row so when you click it opens a page you specify with the documentID of that item. Here is some code that has a very simple one column table. Take a look at Notesin9 and the xpages cheatsheet for some details and better examples.

<xp:table styleClass="table table-hover">


        <xp:tr id="tr1" >
            <xp:td>Name of Row</xp:td>
        </xp:tr>

<xp:repeat id="repeat2" rows="30" value="#{view3}"
            var="rowData">


        <xp:tr id="tr2">
            <xp:td>
                    <xp:text escape="true" id="computedField1"
                        value="#{rowData.fieldName}">
                    </xp:text>
            </xp:td>

          <xp:eventHandler event="onclick" submit="true"
                    refreshMode="complete">
            <xp:this.action>
                        <xp:openPage name="/yourxpages.xsp"
                            target="openDocument"
                            documentId="#{javascript:rowData.getNoteID()}">
                        </xp:openPage>
            </xp:this.action>
          </xp:eventHandler>

            </xp:tr>

        </xp:repeat>

 </xp:table>