Bruce Stemplewski
Bruce Stemplewski

Reputation: 1343

Open document in new tab from xPages viewpanel?

Is there any way to open the document in a new browser tab when the link in a view panel is clicked?

Upvotes: 2

Views: 3425

Answers (5)

Cameron Gregor
Cameron Gregor

Reputation: 1460

Just adding another option to the mix. If you set Column Display as 'hidden' you can then put a standard link control in the column. E.g. if the desired column link text was a 'First Name' column, which opened a new tab to the page 'Person.xsp'

<xp:viewColumn columnName="firstName" id="vcFirstNameCol" displayAs="hidden">

    <xp:viewColumnHeader value="First Name" id="vchFirstName"></xp:viewColumnHeader>

    <xp:link escape="true" text="#{javascript: rowData.getColumnValue('firstName');}" id="link1" value="Person.xsp"
            target="_blank">
        <xp:this.parameters>
            <xp:parameter name="documentId" value="#{javascript:rowData.getUniversalID();}"></xp:parameter>
            <xp:parameter name="action" value="openDocument"></xp:parameter>
        </xp:this.parameters>
    </xp:link>

</xp:viewColumn>

Upvotes: 1

Ramkumar
Ramkumar

Reputation: 842

You have two options. one is the way that Tim explained. And another, you can compute the view column value as link. There you can use the _new or _blank property.

Simply say, View Column can be given as a HTML. There you can compute the page with html href tag.

Upvotes: 2

Bruce Stemplewski
Bruce Stemplewski

Reputation: 1343

After trying this I decided against using it for a number of reasons but want to post the procedure below to implement it.

On the view column Display tab select computed value and enter a formula as follows:

 var _row:NotesXspViewEntry = viewEntry; 

 var _unid = _row.getUniversalID(); 

 return "<a href='0/" + _unid + "?OpenDocument'  TARGET='_new'>" +  _row.getColumnValue("RequestNum") + "</a>"  

On the Display Tab select HTML.

Upvotes: 1

Tim Tripcony
Tim Tripcony

Reputation: 8086

"target" is one of the properties of the view panel component. If you specify "_blank" (as Ferry suggested) as the value of that property, it should apply it to the link for each row. But bear in mind, you're ultimately at the mercy of the end user's browser settings. One user may get a new tab, another may get an entirely new window, and yet another might get nothing because the link was treated as a popup and blocked.

Upvotes: 2

Ferry Kranenburg
Ferry Kranenburg

Reputation: 2635

This is a browser setting only. You only have to put target="_blank" in the link.

Upvotes: 1

Related Questions