Question

I have button in a xpage which creates a document and refreshes a repeat control. All is working fine except the repeat control is showing the newly added document at the top of the table (IMG1).

But after refresh the xpage again, the repeat control renders the table properly (IMG2)

Repeat Code

<xp:panel>
  <xp:table style="width:100.0%">
    <xp:tr>
      <xp:td style="font-weight:bold">
        Hardware
      </xp:td>
      <xp:td style="font-weight:bold">
        Quantity
      </xp:td>
      <xp:td style="font-weight:bold">
        Asset Tag No
      </xp:td>
      <xp:td style="font-weight:bold">
        Previous User
      </xp:td>
      <xp:td>
      </xp:td>
    </xp:tr>
    <xp:repeat id="rpHardware" rows="30" var="clHardwares">
      <xp:this.value>
        <![CDATA[#{javascript:var docMain:NotesDocument = compositeData.docOnboarding.getDocument();
var vwApp:NotesView = database.getView("lkupHardwaresByParentID");
vwApp.getAllDocumentsByKey(docMain.getUniversalID(),true)}]]>
      </xp:this.value>
      <xp:tr>
        <xp:td>
          <xp:text escape="true" id="cfHWName">
            <xp:this.value>
              <![CDATA[#{javascript:clHardwares.getItemValueString("REQ_HW_Name")}]]>
            </xp:this.value>
          </xp:text>
        </xp:td>
        <xp:td>
          <xp:text escape="true" id="cfHWQuantity">
            <xp:this.value>
              <![CDATA[#{javascript:clHardwares.getItemValueString("REQ_HW_Quantity")}]]>
            </xp:this.value>
          </xp:text>
        </xp:td>
        <xp:td>
          <xp:text escape="true" id="cfHWAssetTagNo">
            <xp:this.value>
              <![CDATA[#{javascript:clHardwares.getItemValueString("REQ_HW_AssetTagNo")}]]>
            </xp:this.value>
          </xp:text>
        </xp:td>
        <xp:td>
          <xp:text escape="true" id="cfHWPreviousUser">
            <xp:this.value>
              <![CDATA[#{javascript:clHardwares.getItemValueString("REQ_HW_PreviousUser")}]]>
            </xp:this.value>
          </xp:text>
        </xp:td>

        <xp:td>
          <xp:link escape="true" text="Edit" id="link4">
            <xp:eventHandler event="onclick"
            submit="true" refreshMode="complete">
              <xp:this.action>
                <![CDATA[#{javascript:viewScope.put("selHardware",clHardwares.getNoteID());
getComponent("dlgAddHardware").show();}]]>
              </xp:this.action>

            </xp:eventHandler>
          </xp:link>
          <xp:link escape="true" id="link5" text="Delete">
          </xp:link>
        </xp:td>
      </xp:tr>
    </xp:repeat>
  </xp:table>
</xp:panel>

IMG1

IMG2

Was it helpful?

Solution

Have you tried setting the repeat's "removeRepeat" property to TRUE? This removes unwanted div controls created from the repeat after the control's job is done.

(repeat >> All Properties >> basics)

EDIT:

forgot to mention that your button cannot perform a partial refresh on the repeat itself if that property is set to TRUE. Instead give your surrounding table or an aditional panel its own id which you can use to perform the necessery update

OTHER TIPS

Did you refresh your view after creating the new document?

database.getView("ViewName").refresh();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top