1
votes

I am struggling with a strange effect: In a repeat control I have a custom control with a fileupload and -download control. The item names are calculated with the row var of the repeat, so I can generate "dynamic fields" for my notes document. Works fine (uploads are shown separatly and saved in different richtext items), except the file delete button: It can only delete the file(s) in the last filedownload control of my repeat. As far as I has examined it: The delete buttons of the other filedownloads try to delete files from the last item name in the repeat, not from their corresponding item name.

here is my (simplified for this posting) example code:

xpage:

<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom">

    <xp:this.data>
        <xp:dominoDocument var="test" formName="answers"></xp:dominoDocument>
    </xp:this.data>

    <xp:repeat id="repeat1" rows="30" var="r">
        <xp:this.value><![CDATA[#{javascript:var atts = new Array();
            atts.push("att1");
            atts.push("att2");
            atts.push("att3");
            return atts}]]></xp:this.value>
        <xc:ccdummy fname="#{javascript:r}"></xc:ccdummy>
    </xp:repeat>


    <xp:button value="Save" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true">
    <xp:this.action>
        <xp:saveDocument var="test"></xp:saveDocument>
    </xp:this.action></xp:eventHandler></xp:button>
    </xp:view>

custom control:

<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:panel id="ccpanel">
        <xp:fileUpload id="fileUpload1">
            <xp:this.value><![CDATA[#{test[compositeData.fname]}]]></xp:this.value>
            <xp:eventHandler event="onchange" submit="true"
                refreshMode="partial" disableValidators="true" refreshId="ccpanel">
            </xp:eventHandler>
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="norefresh">
            </xp:eventHandler></xp:fileUpload>
        <xp:fileDownload rows="30" id="fileDownload1"
            displayLastModified="false" hideWhen="true"
            allowDelete="true">
            <xp:this.value><![CDATA[#{test[compositeData.fname]}]]></xp:this.value><xp:eventHandler event="onclick" submit="true"
                refreshMode="norefresh">
            </xp:eventHandler>
        </xp:fileDownload>
    </xp:panel></xp:view>
1

1 Answers

3
votes

Add option repeatControls="true" to your repeat control.

It makes sure that every embedded custom control in repeat control is created separately and acts independently.

I tested it with your example:

  • repeatControls="false": only attachments from last download control can be deleted
  • repeatControls="true": attachments from all download controls can be deleted