kmak
kmak

Reputation: 63

compute dynamically the allowDelete property of file download xpages

I am using a file download control and I would like to set the value of the "allowDelete" property dynamically depending on whether the document is in edit or read mode. However, this property is computed onload of the page. I tried calling the function "setAllowDelete(boolean)" on the onclick event of a button or the "beforeRenderResponse" event of a custom control and a partial or full update to change the value of the property, but it didn't change.

Do you know if there is a way to do this?

Thanks a lot in advance!

Upvotes: 0

Views: 607

Answers (2)

Frantisek Kossuth
Frantisek Kossuth

Reputation: 3524

I have encountered the same problem. There are two options to workaround it.

1) To use two controls, one with deletion enabled, the other with deletion disabled, and use rendered properties according to edit state (or user role).

2) Render download controls by your own, as data table or repeat. However, this solution has its own problems, too.

Upvotes: 2

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

Have you tried just calculating the property like this?

<xp:fileDownload .... >
    <xp:this.allowDelete><![CDATA[${javascript:
        return document.isEditable()}]]>
    </xp:this.allowDelete>
</xp:fileDownload>

Upvotes: 0

Related Questions