In my Xpage I have search criteria at the top of the page and a view at the bottom. The user will select some search criteria and then click search and I do a FT search on the view.
I want to avoid loading the view when first opening the xpage as that takes a lot of time. How can I do this?
Use the rendered property of your view control. Return false for rendered property if search field is empty and return true if it's filled.
Example:
<xp:inputText
id="inputText1"
value="#{viewScope.search}">
</xp:inputText>
<xp:button
value="Search"
id="button1">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="partial"
refreshId="viewForSearch">
</xp:eventHandler>
</xp:button>
<xp:panel
id="viewForSearch">
<xp:viewPanel
rows="30"
id="viewPanel1"
rendered="#{javascript:viewScope.search}">
... pager ... view ... columns ...
</xp:viewPanel>
</xp:panel>
The search field is stored in a view scope variable "search". If it's empty then rendered="#{javascript:viewScope.search}"
returns false and view doesn't get rendered. As soon as user enters a search string and clicks search button #{javascript:viewScope.search}
returns true and view gets visible.
Partial refresh the view control panel clicking on search button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With