0
votes

In an xp:dialog I have a button which loads back-end data and closes the dialog.

<xp:button value="Label" id="button1">
    <xp:eventHandler event="onclick"
        submit="true" refreshMode="partial" refreshId="rptContainer">
        <xp:this.action><![CDATA[#{javascript:
//load data. will not add the code for that but works fine;
viewScope.put("customers",promoBean.getCampaign().getCustomers());
getComponent("dlgCampaign").hide();}]]></xp:this.action>
    </xp:eventHandler>
</xp:button>

On the event I have set partial refresh on a xp:panel control that contains a repeat control that is data-binded to viewScope.

<xp:panel id="rptContainer">
<xp:repeat id="rptCustomers" var="obj" indexVar="index" value="#{viewScope.customers}">...

With help of the xpages debug toolbar I see that the viewScope from the button in the dialog is being updated. but when the dialog is closed the changes are not visible in the repeat control.

I have placed a button outside the dialogbox which only performs the partial refresh and then the repeat control renders the changes.

Can anyone explain me how I can update the repeat control from within the dialog box?

I tried the onHide property of the dialog and used as code:

XSP.partialRefreshGet('#{id:rptContainer}');

But this has no effect.

I even tried a full update for the button event but this has also no result.

Can someone guide me how to do it the proper way?

1
I can't explain but what if you consider closing the dialog in the onComplete CSJS event instead of using the SSJS method? - Oliver Busse
Could not reproduce the behavior, works pretty well here. The used markup is there also. Any omitted details? - Stanislaw Guzik
Btw, do you use the latest Extension Library version available for you Domino server? - Stanislaw Guzik
Hello Stanislaw, thank you so much for your feedback.Yes your code works. Mine still does not. I added now a button that explicitly performs a partial refresh on the repeat control. I trigger this button via csjs in the onhide event for the dialog. this seems to work. In the same event I tried a XSP.partialRefreshGet("#{id:rptContainer}"); but that did not work either. I know, not the nicest work around and your example does work. But my application not although I have the same approach/logic. Thanks again! - Malin

1 Answers

0
votes

when I close a dialogbox through SSJS, I close it using following syntax:

<xp:button value="OK" id="btnOK">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
        <xp:this.action><![CDATA[#{javascript:/*your processing code*/
             var dialogBox = getComponent('/*id of the dialog to close*/');
             dialogBox.hide('/*id of the component to refresh*/');}]]> 
       </xp:this.action>
    </xp:eventHandler>
</xp:button>

Although the refresh mode is 'complete', only the component in the 'hide' method is refreshed.