Marc Jonkers
Marc Jonkers

Reputation: 506

open blank page (new page) on clicking calculated page url in a view

I've got following viewPanel. I would like to open a new page when the users clicks on the calculated page url. I just don't seem to figure this out.

<xp:viewPanel rows="30" id="viewPanel9" showColumnHeader="false" var="rowData"viewStyle="width:auto" disableTheme="true">
<xp:this.data>
    <xp:dominoView var="view9" databaseName="product/picture.nsf"
    viewName="pictures3" keysExactMatch="true"
    keys="#{javascript:sessionScope.SelectedProduct;}">
    </xp:dominoView>
</xp:this.data>
    <xp:this.rendered><![CDATA[#{javascript:getComponent("viewPanel9").getRowCount() > 0}]]>
    </xp:this.rendered>
        <xp:viewColumn columnName="picDescr" id="viewColumn9" displayAs="link" openDocAsReadonly="true">
            <xp:this.iconSrc><![CDATA[#{javascript:thisid = rowData.getColumnValue("unid");
                thisdocument = rowData.getColumnValue("picName");
                calculatedlink = "servername/product/picture.nsf/O/"+thisid+"/$FILE/"+thisdocument;
                return calculatedlink}]]>
            </xp:this.iconSrc>
            <xp:this.pageUrl><![CDATA[#{javascript:thisid = rowData.getColumnValue("unid");
                thisdocument = rowData.getColumnValue("picName");
                picturename = thisdocument.replace("th_","");
                calculatedlink = "servername/product/picture.nsf/O/"+thisid+"/$FILE/"+picturename;
                return calculatedlink}]]></xp:this.pageUrl>
        <xp:viewColumnHeader value="Description" id="viewColumnHeader9">
        </xp:viewColumnHeader>
        </xp:viewColumn>
</xp:viewPanel>

Upvotes: 1

Views: 996

Answers (2)

David Navarre
David Navarre

Reputation: 1022

I think I would use a repeat control instead.

Up near the top establish the linkage to the data as you did:

<xp:this.data>
    <xp:dominoView var="contactsView"
        viewName="TeamDirectoryNameLU">
    </xp:dominoView>
</xp:this.data>

and then, where you want your "view":

<ul>
    <xp:repeat id="contactRepeat" rows="30" value="#{contactsView}" var="dataRow" disableOutputTag="true">
        <li>
            <xp:link escape="true" id="link1">
                <xp:this.value><![CDATA[#{javascript:return "m_ContactDetails.xsp?action=OpenDocument&documentId=" + dataRow.getDocument().getUniversalID();}]]></xp:this.value>
                <xp:this.text><![CDATA[#{javascript:return dataRow.getColumnValue("Name");}]]></xp:this.text>
            </xp:link>
        </li>
    </xp:repeat>
</ul>

I got the basics of that from TeamStudio in their recent video on mobile apps. It's part of a jQuery-powered contacts list that opens the contact details XPage for the contact you click on.

Upvotes: 1

Naveen
Naveen

Reputation: 6936

Some time back I was grappling with same issue. I created a workaround for it which works, but I don't know if it is the best way to go about it.

First set the displayAs attribute of xp:viewColumn to hidden. So it looks something like this:

<xp:viewColumn columnName="picDescr" id="viewColumn9" displayAs="hidden" openDocAsReadonly="true">

Now put a Link control in the column, you would have to do this in Source tab. You can then set the target attribute to _blank for the Link control. So your code would look something like this:

<xp:viewColumn columnName="picDescr" id="viewColumn9" displayAs="hidden" openDocAsReadonly="true">
    <xp:link escape="true" target="_blank">
        <xp:this.text><![CDATA[#{javascript:rowData.getColumnValue("picDescr");}]]></xp:this.text>
        <xp:this.value><![CDATA[#{javascript:thisid = rowData.getColumnValue("unid");
thisdocument = rowData.getColumnValue("picName");
picturename = thisdocument.replace("th_","");
calculatedlink = "servername/product/picture.nsf/O/"+thisid+"/$FILE/"+picturename;
return calculatedlink}]]></xp:this.value>
    </xp:link>
...
...
...
</xp:viewColumn>

Upvotes: 3

Related Questions