<pm:tabMenu load p:repeat only if needed

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
vished
Posts: 479
Joined: 02 Feb 2014, 17:38

30 Aug 2019, 09:20

Dear all,

I have the current problem, that a list (p:repeat) is calling everytime to the bean (request to the database) as soon the <pm:tabMenu is loaded which costs performance and increase the page load...
Is there a possibility to load this list only if the user clicks this menu entry?

So from the example page:
https://www.primefaces.org/morpheus/

If the user clicks the menu entry: "features" than the <p:repeat> should be loaded:
Here is a short example:
-> value="#{lastUsageLast25EntriesNotLazyController.lastUsageList}" from <p:repeat should be load / request to database only if the user is click on:
<pm:tab id="tab1" icon="fa fa fa-tachometer" title="ALLGEMEIN">

Code: Select all

<pm:tabMenu id="tabMenu" stateful="false">

			<pm:tab id="tab1" icon="fa fa fa-tachometer" title="ALLGEMEIN">
				<h:form id="menu-form">
					<pm:menu widgetVar="me">
						<p:menuitem value="Dashboard" icon="fa fa-tachometer"
							outcome="/portal/dashboard" />
					</pm:menu>

					<div class="layout-submenu-title" />
					<h:outputText value="ZULETZT VERWENDET" styleClass="FontBold" />

					<p:repeat
						value="#{lastUsageLast25EntriesNotLazyController.lastUsageList}"
						var="lastUsage">

						<h:outputFormat escape="false"
							style="margin-left: 5px;  white-space: nowrap;"
							value="#{lastUsageLast25EntriesNotLazyController.generateString(lastUsage)}" />

						<p></p>
					</p:repeat>

				</h:form>
			</pm:tab>

BTW: i tried also to use p:cache around the whole <pm:tabMenu id="tabMenu" but than if I click on a menu entry nothting is happening, but I don´t think so that´s also the solution because the <p:repeat will be than also cached?

How can I do this?
PF 8.0

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

02 Sep 2019, 15:25

Could you please try it with ui:repeat and o:cache of omnifaces? https://www.byteslounge.com/tutorials/h ... sf-example

vished
Posts: 479
Joined: 02 Feb 2014, 17:38

02 Sep 2019, 21:29

I´ve tried:

Code: Select all

	<div class="layout-sidebar">
<o:cache>
		<pm:tabMenu id="tabMenu" stateful="false">

			<pm:tab id="tab1" icon="fa fa fa-tachometer" title="ALLGEMEIN">
But than no menu is opening....
Also my URL will get a "#" like, mypage.jsf#

How can this be solved?
PF 8.0

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

20 Dec 2019, 16:29

Do you get an error on console?

Post Reply

Return to “Morpheus - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests