1
votes

on Sven's blog http://hasselba.ch/blog/?p=1383 he has posted a great article on optimizing partial refreshes. I tried posting the following question but it keeps saying that it is spam. So I thought that I would come here and ask. The code he posted is:

<xp:button
        value="Cleaned Refresh"
        id="buttonCleaned">
        <xp:eventHandler
            event="onclick"
            submit="false">
            <xp:this.script>
                <![CDATA[
                    XSP.partialRefreshPost(
                        '#{id:refreshMe}',{
                            clearForm: true,
                        }
                    );]]>
            </xp:this.script>
        </xp:eventHandler>
    </xp:button>

What does the line "clearForm : true" do, I don't see it referenced anywhere? I use the partialRefreshPost in the onCompleted event to refresh additional fields, from what I see in this code you would not use the Partial Refresh Properties on an event but add this code to the say onClick event instead. Do you do this in all cases or just special cases? For example on a page I have an onChange event on 5 or 6 different fields that does a partial refresh on an id, there are 30 + fields on the page so this page would appear to be doing a lot more than is really needed.

1
clearForm is added by Sven to his special partial refresh. It is coded in snippet. You would use this parameter only if you use Sven's approach and include the snippet into your XPage and want to use this optimized refresh in a certain case. - Knut Herrmann

1 Answers

0
votes

Immediately above the example code in your link,

The optimized version adds the option clearForm to partial refreshs. When using this option, only the XPages internal fields are sent to the server, but DOM will be refreshed correctly: