XPages: Why does my functions run multiple times inside events and properties?

81 Views Asked by At

I wrote a function that will be executed before page load (beforePageLoad()) inside a custom control. The custom control is only used once in an XPage. But I noticed that it is being executed multiple times (2 - 4 times, different number of times).

<xp:this.dataContexts>
  <xp:dataContext var="filterOptions">
     <xp:this.value><![CDATA[#{javascript:getFilterOptions("wvAP");}]]></xp:this.value>
  </xp:dataContext>
</xp:this.dataContexts>
<xp:this.beforePageLoad><![CDATA[#{javascript:beforePageLoad();}]]></xp:this.beforePageLoad>

I used a function too inside a dominoView search property and same thing happens (control is also used once in the page):

<xp:this.data>
        <xp:dominoView var="viewBP" viewName="wvBP"
            ignoreRequestParams="true"
            search="${javascript: getSearchQuery(); //on page reload because if dynamic, called 4x}">
        </xp:dominoView>
    </xp:this.data>

I already set it to on page load only, but it still runs multiple times. What do you think I'm doing wrong here? Or am I missing a config or something? Thanks!

0

There are 0 best solutions below