I have an xpage with a view control and a document datasource. When I click a document in the view I want it to open in the document datasource (without refreshing the complete page in the browser). In my clickable column I have selected “partial update” for the onclick event and I have selected the panel with my document datasource as the item to be updated. I now have to enter a formula for the document datasource “Document ID” property that will compute the document ID for the document that was clicked in the view but I do not know how to do that.
I now have this working with some hardcoded document ID’s that get opened when I click in the view-column.
I have found some code how to get the selected documents in a view using checkboxes but I don’t want to use checkboxes for this.
Any help that will steer me in the right direction will be greatly appreciated!
Here’s what I have used in the past. On the onclick event I would set a session variable to the noteID (or I prefer the universalID), then pick that variable up in the documentid datasource.
First you need to set a variable for the view data:
click on the view
select all properties tab
add a variable name to Data → Var (such as “projectrow”)
Next on the view column → onclick event. Add the following code:
doc=projectrow.getDocument();
sessionScope.docid=doc.getNoteID();
Then in your formula for the documentid you can pickup the session variable like this:
That works great and is a very useful solution for me because I didn’t know you could use the “projectrow” variable in the onclick event and I learned using session variables at the same time! Thank you very much!