I want to add an option to the row of the view: the possibility to open the document when clicking on the row. It is possible? How can I achieve this?
2 Answers
Add displayAs="link"
to viewColumn. Then it is rendered as link and opens the document if you click on it. You can also choose to open it in edit or read mode.
Set the attributes in properties panel:
Update:
You can open the corresponding document clicking somewhere on a viewPanel's row (not just on a column's link) if you add a rowAttrs
property.
Add the following code to your viewPanel:
<xp:viewPanel
rows="30"
id="viewPanel1"
var="row">
...
<xp:this.rowAttrs>
<xp:attr
value="window.open('#{javascript:row.getOpenPageURL(null, true)}', '_self')"
name="onclick"
rendered="#{javascript:!(row.isCategory() | row.isTotal()) }">
</xp:attr>
</xp:this.rowAttrs>
</xp:viewPanel>
Set viewPanel's row variable to var="row"
. The attribute attr
gets rendered for all rows which are represent a document. It adds an individual onclick
event to those rows and executes CSJS code defined in value
. This CSJS code contains a SSJS part which inserts the URL of the document as window.open's parameter.
If you set getOpenPageURL's second parameter to false
then document will be opened in edit mode.
Look here for a detailed description.

- 30,880
- 4
- 31
- 67
-
I know this, but I want to add this property to the whole row, not to the text inside the columns. – Florin Pop Sep 17 '14 at 14:13
-
the rowAttr is not by default available by the view panel control, but for the data table control? – Patrick Kwinten Jun 08 '16 at 10:36
-
@Patrick: rowAttr is available at "All Properties / basics" for both view panel and data table control. – Knut Herrmann Jun 08 '16 at 10:47
I think there is no easy way ;-) Maybe JQuery is your friend to add a on click event to the row with needed

- 1,271
- 7
- 10