1
votes

I have a view panel control that displays a list of documents and some information about each. One of the columns is the storage location of the item recorded in the document. I want to make that column a clickable link so when the user clicks it, they go to a different XPage that shows all the documents with that storage location. An example:

ID          Location
12345678    ABCD
98765432    WXYZ
11223344    ABCD

Clicking the ID would open that document, but clicking ABCD would go to an XPage that would display all documents with a Location of ABCD.

This is what I have for the column value:

<xp:this.value><![CDATA[#{javascript:return "<script>sessionScope.set(\"trayId\",\"+rowData.getColumnValue('StorageLocationID')+\");</script><a href=\"./location.xsp\">"+rowData.getColumnValue('StorageLocationID')+"</a>";}]]></xp:this.value>

It displays the value properly and goes to the right XPage but I can't figure out how to set the sessionScope variable that I can use to filter the data source on location.xsp to show just the one location. I think I have to create HTML in the column because it threw an error when I set 'Show values in the column as links' and used onclick events to set a sessionScope variable for the location name and then open the location.xsp.

I could probably do this in a repeat control, but it seems like there should be a way to make this work in a view panel, since I feel like I am really close.

1

1 Answers

2
votes

Don't set a sessionScope variable, just add a parameter ?location= to URL:

<xp:this.value><![CDATA[#{javascript:"<a href=\"./location.xsp?location=" + rowData.getColumnValue('StorageLocationID') + "\">"+rowData.getColumnValue('StorageLocationID')+"</a>"}]]></xp:this.value>

mark the location column with contentType="HTML" and use the URL location parameter in your location.xsp for filtering your locations view:

    <xp:this.data>
        <xp:dominoView var="viewLocations" viewName="Locations"
            keys="#{javascript:context.getUrlParameter('location')}"
            keysExactMatch="true">
        </xp:dominoView>
    </xp:this.data>