This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 30, 2015, 3:47 AM
94 Posts

How do I refresh doc data sources in a repeat control?

  • Category: Debugging
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 7

I have a view that lists documents by category and column 3 contains the unid of each document.  My repeat control returns a list of unids from a dblookup into this view.  Within the repeat, I have a panel that binds to the document for that rows unid.  So, multiple rows in the repeat represent multiple documents.  I hope this is clear.  Fields within each panel are then bound to each document.

For this example, the repeat returns 3 unids, so my repeat contains 3 rows/panels bound to each document.  I have a button that changes a field in each of these 3 documents, but when I refresh the page (even a full refresh) the fields in the repeat will not show the update.  I also tried refreshing the view that provides the unids, that doesn't help either.

If I go to another page and come back, the values show correctly.  Click the button to change the values in each document, and nothing changes in the repeat.

I'm sure I'm missing something simple - how do I get the repeat to show the CURRENT values from the backend documents?

(create controls at page creation is unchecked)

 

Jul 30, 2015, 3:09 PM
453 Posts
Some Thoughts ....

First I would not us @DBLookup to get the values - don't think this is the problem but just would not do it that way. From what I understand it is not a very efficient way to get the values - better to use SSJS or a Bean to generate the list.

I have a 'view' (understand that the definition of a view in XPages is different from a view in native Notes but I still use view in the traditional sense) that I generate by a FT search and return a list of UNIDs that I store in a viewScope.vsUNIDS variable and then bind a repeat to vsUNIDS. I do a fair bit of processing on this lookup but the presentation is pretty simple. I have the  repeat contained inside an <xp:panel id="panelRepeat" and do a partial refresh on panelRepeat. If there is a change to viewScope.vsUNIDS it gets re-displayed properly.

The ability to bind a repeat to a scoped variable is a powerful tool that took a while for me to realize that repeats can be bound to all manor of things.

Hope this helps. 

Jul 30, 2015, 3:42 PM
94 Posts
I think we're getting closer....

This is a section of my repeat control... each row is enclosed in a panel bound with the unid from the repeat formula.  Only one row can be checked for "Quote".  So, when I click my button to select row 3 to Quote, that button then updates the docs in row 1 and row 2 to clear that flag in those documents.  However, I cannot get that button to update the fields in the repeat - as shown above, it looks like there are two docs with the Quote flag set, when in fact, there is only one.  (my button is within the data source panel for each row)

Howard, your hint for ds.get(0).refresh() will work for the current panel (which contains the button), but the issue is actually updating the docs in the other panels of the repeat (those where I cleared the flag).  How do I get a handle to those panels when they're all named the same in the repeat?

Jul 30, 2015, 11:44 PM
586 Posts
hmmm

Bob,

It would be great if you showed the actual code for the repeat control.I'd like to see that.

I typically I have my repeat control itself inside a panel and do a partial refresh on that and it updates anything I need.

I have seen, on rare occasion when something doesn't get updated as expected, the need to go into the onComplete event of the button and use CSJS to trigger the partial refresh.  XSP.partialRefresh something or other...  I can never remember.  In those cases it seemed like XPages was beating the view update or something...  so that might come into play but I do think it would be helpful to post your code.

Good Luck

Dave

Jul 31, 2015, 12:44 AM
94 Posts
Here is the code for the repeat control on that page

QuoteSel is the field value that can only be set in one doc at a time.  The other docs are supposed to be updated in the Save button. 

 

<edited Aug 17th, 2015 to only show what should be relevant>

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    style="background-color:rgb(233,233,233)">
    <xp:panel id="panelMatCostData">
        <xp:repeat id="repeat1" rows="30" var="matcostdata"
            indexVar="matcostindex" repeatControls="false">
            <xp:this.value><![CDATA[#{javascript://return a list of docunids
                <<<<unid code removed for clarity>>>
                return list;
            </xp:this.value>
    
            <xp:panel id="panelMatRow">
                <xp:this.data>
                    <xp:dominoDocument var="matcostdoc"
                    formName="Material" documentId="#{javascript:matcostdata}"
                    ignoreRequestParams="true">
                    <xp:this.action><![CDATA[#{javascript:if(matcostdata==""){
                        "createDocument";
                        }
                        else {
                        "openDocument";
                    }}]]></xp:this.action>
                    </xp:dominoDocument>
                </xp:this.data>

                <xp:checkBox text="Quote" id="Quote" value="#{matcostdoc.QuoteSel}" checkedValue="Y" uncheckedValue="N"></xp:checkBox>

                <xp:button value="Save" id="button2" style="width:75px" rendered="#{javascript:matcostdoc.isEditable()}">


                <xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="panelMatRow" id="eventHandler6">
                    <xp:this.action>
                    <xp:actionGroup>
                        <xp:saveDocument
                        var="matcostdoc">
                        </xp:saveDocument>
                        <xp:changeDocumentMode
                        mode="readOnly" var="matcostdoc">
                        </xp:changeDocumentMode>
                    </xp:actionGroup>
                    </xp:this.action>
                </xp:eventHandler>
                </xp:button>
            </xp:panel>
        </xp:repeat>
    </xp:panel>
</xp:view>

Aug 10, 2015, 3:23 PM
453 Posts
When i doubt ...

Your example is so long that it is really hard to figure out where it might be going. I find that when things don't work the way I figure they should the best solution is to back up and build as simple a test case as possible. Then start building it up from there. As a process becomes more complex I find that various processes can conflict to that strange things happen. Also, when dealing with a repeat control you need to be careful that you are operating within the scope of the repeat. 

Aug 17, 2015, 1:28 PM
94 Posts
I edited that last post with clear source code

This is still an open issue for this new application, so thank you for your patience

I tried to have my Save button refresh panelMatRow (which is inside the repeat) but that didn't work.  So, I also tried refreshing panelMatCostData (which contains the repeat) but that didn't work either.  I also tried having the Save button perform a full refresh, but still no dice.  While I had the page in my browser, I clicked on the url refresh indicator, too, but no luck.

I also added a view.refresh to the Save button, thinking the index needed to be updated as well, but that didn't help either.

I need to have the documents in the repeat control basically rebind themselves in order to get the updated values from the backend documents.

Howard's suggestion was a good one, however, it only updated the current row (doc).  I need to update all the other rows (docs) as well.

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal