0
votes

I have a repeat control on an xPage with a text field displayed directly in edit mode. When a user changes the value in the field, I need them to be able to either:

  1. Select an icon directly beside the field to save the value in the document.
  2. Make changes to this field in more than one document and click a button to save all of these changes to the appropriate documents saved simultaneously.

What I have so far is a method of capturing the unids of the documents whose editable field has been updated.

I cannot get either of these saves to work. I have listed below the portion of the code that controls these areas.

Here's the save all and sessionScope information

<xp:panel id="InlineEditContainer" xp:key="facetMiddle" style="width:100%">
<xp:this.data>
<xp:dominoView var="view1" viewName="vwMetricsByAssigned">
<xp:this.postOpenView><![CDATA[#{javascript:var myList = new java.util.ArrayList();
sessionScope.put("myList", myList);}]]></xp:this.postOpenView></xp:dominoView>
</xp:this.data>
<xp:button value="Submit All" id="button1">
<xp:eventHandler event= <"onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:// Getting list of unids from docs which have been        updated, and saving those docs
var db:NotesDatabase

if(sessionScope.myList == null){
return;
}else{
for (var s in sessionScope.myList){
    var doc:NotesDocument = (db ? db.getDocumentByUNID(s) : database.getDocumentByUNID(s));
    if (doc && doc.isValid()) { 
        doc.save();
    }
}
}}]]></xp:this.action>
                </xp:eventHandler>
            </xp:button>
            <xp:br></xp:br>
<xp:repeat id="repeat1" rows="30" value="#{sessionScope.myList}" var="listData">        
    <xp:text escape="true" id="computedField6"><xp:this.value><![CDATA[#{javascript:listData +    " , "}]]></xp:this.value></xp:text></xp:repeat>

<xp:br></xp:br>

Here's all the repeat data

<xp:repeat id="repeat2" rows="20" var="FColl" indexVar="idx" value="#{javascript:view1}">
<xp:panel id="InlineEditContainer2">
<xp:this.data>
<xp:dominoDocument var="document1" formName="frmMetricData"                                  action="editDocument" documentId="#    {javascript:FColl.getNoteID();}" >
</xp:dominoDocument>
</xp:this.data>
<xp:tr>
<xp:td id="td1">

<xp:text escape="true" id="computedField3">
<xp:this.value>    <![CDATA[#javascript:FColl.getDocument().getItemValueString("BusinessUnit")}]]>   
</xp:this.value>
</xp:text>
</xp:td>
<xp:td id="td2">
<xp:link escape="true" id="link1" value="/MetricData.xsp">
<xp:this.text><![CDATA[#{javascript:FColl.getDocument().getItemValueString("MetricName")}]]>  </xp:this.text>
<xp:eventHandler event="onclick" submit="true"                                            refreshMode="norefresh" immediate="true">
<xp:this.action>
<xp:openPage name="/MetricData.xsp" target="editDocument"                              documentId="#{javascript:return FColl.getNoteID();}" />
</xp:this.action></xp:eventHandler>
</xp:link>
</xp:td>
<xp:td id="td3">
<xp:inputText id="EditBox3" value="#{document1.Actual}" tabindex="1">
<xp:this.defaultValue><![CDATA[#    {javascript:FColl.getDocument().getItemValueString("Actual")}]]></xp:this.defaultValue>
<xp:this.converter>
<xp:convertNumber type="number" integerOnly="true" />
</xp:this.converter>
<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="repeat1">
<xp:this.action><![CDATA[#{javascript:// get the universalID of the document
var keyCode = FColl.getDocument().getUniversalID();

// Create an Array
var myArray = sessionScope.get("myList");

//If it's not already in the Array then add it.
if (!myArray.contains(keyCode)) {
myArray.add(keyCode);
}}]]></xp:this.action>
</xp:eventHandler></xp:inputText>
<xp:span>
<xp:image url="/.ibmxspres/domino/oneuiv2/images/iconConfirmation16.png" id="image1">
<xp:eventHandler event="onclick" submit="true"                                               refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1" />
</xp:this.action>
</xp:eventHandler>
</xp:image>
</xp:span>

If anybody can give me any ideas to try, I would be very grateful.

1

1 Answers

1
votes

Make it simple! There is a simple action "save". Comes in save and save all flavors. The later goes below the repeat and saves any changed document.