David Newman
David Newman

Reputation: 11

Opening different xpages forms from a view panel

I have an Xpages application that pulls data from another .nsf file. I have a view panel linked to a view in that db. The view has documents with several different forms in it. I want to be able to open each document in it's own form(xpage).

How do I write a computed At Runtime, open selected document using: statement that will select the correct Xpage to present the document.

Upvotes: 1

Views: 1587

Answers (5)

Newbs
Newbs

Reputation: 1632

I have used the extension library Dynamic View control which has an event you can code to get a handle to the NotesViewEntry which was selected. See the demo database page Domino_DynamicView.xsp and the Custom Event Handler tab for an example.

Note, in 8.5.3 (I have not upgraded yet) if you add or edit the eventHandler for onColumnClick it will be added to the XPages source as an xe:eventHandler. It needs to be an xp:eventHandler to work. The way to do it is to copy the code in the source from the exiting event and delete it. Recreate the event and update the code. Then go back into the source and change the tags within the eventHandler to xp:.

Upvotes: 0

AttilaBorbás
AttilaBorbás

Reputation: 69

I had a similar problem today. I use only one form but 3 different xpages for associated with this form. I have 3 different document types in the view. I used rowData the get the type of the document.

try{
    var v=rowData.getColumnValue("form");
    if(v.indexOf("x")> -1){var page ="x.xsp"}
    else if(v.indexOf("y") > -1){var page = "y.xsp"}
    else{var page = "z.xsp"}
}catch(e){
    var page = "x.xsp"
}

So to your view you can create a column with the value of the form and you can use it.

Upvotes: 1

stwissel
stwissel

Reputation: 20384

You have 2 options:

  • use "use xpage associated with form" and edit the form's property

  • use a SSJS formula to compute the Form. You provide a variable name in the view control var to access a view row as XSPViewEntry. If the Form is in a view column even one you don't display you use .getColumnValue otherwise getDocument.getItemValueString

Does that work for you?

Upvotes: 2

Tim Tripcony
Tim Tripcony

Reputation: 8086

If you use the Data View component instead of a View Panel, you can compute the pageName attribute, referencing the var attribute to return a different value for each row based on the document that row represents. The flexibility of the Data View component also makes it easier to make your app look more like a modern web application and less like an Excel spreadsheet. As an additional bonus, the mobile theme invokes a renderer that makes each Data View instance look like a native mobile list, so using Data Views instead of View Panels simplifies mobile development.

Upvotes: 2

user2446292
user2446292

Reputation: 63

Maybe this mothed can help you: Unable to get document page name for

Hope this helps

Mark

Upvotes: 1

Related Questions