Reputation: 39
I have a very long xpage-based form which needs completing so I decided to break it down into a set of panels, each of which is rendered or not based on the checked values in a checkbox group.
My issue is that the larger panels (containing 30 or so fields) take over 20s to display using a partial refresh on the onchange event handler of the checkbox field. I assumed this was just down to the amount of content, but if I remove the render formula completely from all panels, the whole form including all panel content initially displays in just a few seconds.
The structure is:
<xp:panel id="allPanels">
<xp:panel id="panel1"></xp:panel>
<xp:panel id="panel2"></xp:panel>
<xp:panel id="panel3"></xp:panel>
</xp:panel>
with the onchange event refreshing "allPanels".
Does anybody have any ideas why there is such a delay as it is currently unusable!
Many thanks
Upvotes: 0
Views: 170
Reputation: 15739
@DbLookup is particularly bad for performance, you'll see that in various blog posts available. See for example xPages @DbLookup issue. APIs that don't use formula language will be better performant - there is no formula language engine in XPages, everything is Java. SSJS maps to Java methods; @DbLookups map to multiple Java methods (for each of the parameters).
Also see my webinar "Marty, You're Not Thinking Fourth Dimensionally" (2016 Webinars tab at http://www.tlcc.com/admin/tlccsite.nsf/pages/recorded-xpages-webinars). What is calculated when is a topic I've talked about over a number of years, and it explains exactly why it's quicker on initial load. There are various options for improving performance. "Compute on Page Load" rather than "Compute Dynamically" is preferable. view.isRenderingPhase()
can be used to minimise the number of computations, where appropriate. Another option may be to run code in the onClick to set viewScope variables and reference those, rather than running lookups in situ.
Upvotes: 1
Reputation: 705
You could try adding execId="YOURCHECKBOXFIELDID"
to the event handler of your checkbox group which will only send the value of your checkbox to the server for partial refresh, not all other fields.
Also, take a look at the answer I gave to a similar question here: Complex Xpage takes long for partial refreshs which might help?
Infact I've just noticed Knut mentioned the execId point as a response to the above question also!
Upvotes: 0