This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 18, 2011, 11:54 AM
2 Posts

edit document clicking in view row

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer,Administrator
  • Tags:
  • Replies: 3
Hello,
 
Is there any way to Edit document by clicking anywhere on  a view row?
 
Regards
Mar 21, 2011, 8:02 AM
22 Posts
Re: edit document clicking in view row
I am not sure (haven't tried before), but I believe you may be able to accomplish this functionality using a repeat control.
 
Use the view as a data source for the repeat control, which renders a row for each document.
You should then be able to assign an eventHandler to the row, and execute script to edit the associated document.
 
Perhaps try something like the following (knocked up in Notepad - please excuse errors!):
 
<xp:table>
  <xp:repeat id="repeat1" value="#{yourView}" var="rowData" indexVar="rowIndex">
  <xp:tr>
    <xp:td>
      <xp:text escape="false" id="data">
      <xp:this.value><![CDATA[#{javascript:rowData.getColumnValue("someField")}]]></xp:this.value>
      </xp:text>
    </xp:td>
    <xp:eventHandler event="ondblclick" submit="false">
      <xp:this.action>
      <xp:openPage name="/docXpage.xsp" target="editDocument" documentId="#{javascript:rowData.getUniversalID()}">
      </xp:openPage>
      </xp:this.action>
    </xp:eventHandler>
  </xp:tr>
  </xp:repeat>
</xp:table>
 
Hope that helps you out!  T.
Mar 21, 2011, 2:45 PM
33 Posts
Re: edit document clicking in view row
Using a repeat control would work best...
 
However, I believe you could add an action to each column of your table which opened the relevant document using the documentID.  Messy but view controls have limited features compared to repeats.
 
Ian 
Mar 21, 2011, 10:20 AM
122 Posts
Re: edit document clicking in view row
If you want to open a document in edit mode from a view, that can be done by setting the default action of the XPage it redirects to. Alternatively you can add a link to the column and manually configure the link to add a request parameter "myPage.xsp?action=editDocument".
 
If you want to edit in place, then again you'll need to add controls to your view panel to handle edit and read versions of the data. You need to set a "var" in All Properties of the View Panel - this is how you refer to each row's data, same as a repeat control. Then set the value for a column to "" - this means it will use what you add instead. Then add events to set a viewScope variable to the ID of the document on that row. Set the visibility of the editable/read only controls, so that the editable version is visible if the current row's document ID is the same as the document ID in the viewScope variable and vice versa. Now you just need to write SSJS to store the values back. Bear in mind though that you don't have access to an front-end document, so you can't just bind the editable controls to column values because column values aren't editable. You'll just get read only versions of e.g. an edit box.
 
This process can be used for a View Panel, Data Table or Repeat Control. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal