compute dynamically the allowDelete property of file download xpages

核能气质少年 提交于 2019-12-12 03:46:01

问题


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!


回答1:


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.




回答2:


Have you tried just calculating the property like this?

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


来源:https://stackoverflow.com/questions/14746894/compute-dynamically-the-allowdelete-property-of-file-download-xpages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!