VladP
VladP

Reputation: 901

XPage fileDownload1 control becomes editable on page full refresh?

Why fileDownload1 control becomes editable (delete file attachment icon appears next to fileDownload control) when I just refresh the page. Here is my code where I use a button to refresh the page (just for the example)

<xp:button value="Label" id="button1">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete"></xp:eventHandler>
</xp:button>
<xp:this.data>
    <xp:dominoDocument var="document1" formName="myXpage"
      databaseName="${javascript:sessionScope.SUPPORT_DB_FILE}"
      action="openDocument">
    </xp:dominoDocument>
</xp:this.data>
<xp:fileDownload 
     id="fileDownload1" 
     rows="30" 
     displayLastModified="false" 
     displayType="false" 
     displayCreated="false"
     hideWhen="true" 
     allowDelete="true"
     value="#{document1.MyBodyRTF}">
</xp:fileDownload>

Upvotes: 0

Views: 48

Answers (1)

Eric McCormick
Eric McCormick

Reputation: 2733

I tried to replicate what you're describing, but am having trouble doing so. I created a new XPage and modeled it after your sample code.

Notable differences:

  • I never see the trash icon
  • I had to compute the UNID of some document with an attachment in the appropriate field
  • I set both the DB name and UNID in beforePageLoad
  • I noticed an interesting change in the UI behavior (see animated gif below)

I'm not sure what you're running into without having more source code to be able to view, but I can confirm that what I tried doesn't reproduce the result you're describing.

XPage source:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.beforePageLoad><![CDATA[#{javascript:sessionScope.myDbName = database.getFilePath();
var vw:NotesView = database.getView("SomeForms");
var first:NotesDocument = vw.getFirstDocument();
sessionScope.myFirstDoc = first.getUniversalID();
first.recycle();
vw.recycle();}]]></xp:this.beforePageLoad>
    <xp:this.data>
        <xp:dominoDocument
            var="document1"
            action="openDocument"
            formName="SomeForm"
            databaseName="${javascript:return sessionScope.myDbName;}"
            documentId="${javascript:return sessionScope.myFirstDoc;}" />
    </xp:this.data>
    <xp:fileDownload
        rows="30"
        id="fileDownload1"
        displayLastModified="false"
        value="#{document1.SomeAttachments}" />
    <xp:button
        value="Refresh"
        id="button1">
        <xp:eventHandler
            event="onclick"
            submit="true"
            refreshMode="complete" />
    </xp:button>
</xp:view>

strange ui movement

Upvotes: 1

Related Questions