Hi,
I like this template really much, but currently I have the problem the page load it not really fast due to the following reasons:
Left menu:
- I have on the left side in the calendar e.g. p:repeat to load the last 20 meetings from my database
Topbar:
- Load notifications
- Load messages
- Load image from loggedin user
This means, it´s for each page request also everytime a request against to the database, which slow down the whole application.
Can you give me a few ideas, how I can improve this to avoid to have always a request against the database?
- E.g. caching?
- 20 Meetings (left menu) will be loaded (request to database) only if the user open the second icon (calendar) ? -> how is this possible? I think this can be managed with the new event in the menu?
Any ideas?
Cache / Avoid request to database for each page request
Forum rules
Please note that response time for technical support is within 3-5 business days.
Please note that response time for technical support is within 3-5 business days.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
So sorry for the delayed response!
Best Regards,
So sorry for the delayed response!
- Yes, a new event can be added for this issue. We can implement this with you next week ??I think this can be managed with the new event in the menu?
Best Regards,
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
Sorry for the delayed response. Yes, I added tabChange and tabContentLoad events for this. You can use tabContentLoad event to load dynamic content.
Best Regards,
Sorry for the delayed response. Yes, I added tabChange and tabContentLoad events for this. You can use tabContentLoad event to load dynamic content.
Code: Select all
<h:form>
<pm:tabMenu id="tabMenu">
<p:ajax event="tabContentLoad" listener="#{testView.loadContent}" update="tab1:tab1_menu" />
<pm:tab id="tab1" icon="pi pi-folder-open" title="FEATURES">
<pm:menu id="tab1_menu" model="#{tabView.model}" widgetVar="MorpheusMenuWidget">
</pm:tab>
</pm:tabMenu>
</h:form>
...
public void loadContent(TabContentLoadEvent e) {
Tab tab = e.getTab();
if (tab.getTabIndex() == 0) {
// add items to model
}
}
Github Profile: https://github.com/mertsincan
That´s great... Mabe it will fix my issue with p:cache...
Can you give an example how the backend bean should be looing like to create the model like:
What is "model" ?
Can you give an example how the backend bean should be looing like to create the model like:
Code: Select all
<pm:menu id="tab1_menu" model="#{tabView.model}"
Primefaces 12.0, WildFly 21
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks a lot for your update! You can examine "Programmatic" section;
https://www.primefaces.org/showcase/ui/menu/menu.xhtml Or https://www.primefaces.org/showcase-v8/ ... menu.xhtml
Best Regards,
https://www.primefaces.org/showcase/ui/menu/menu.xhtml Or https://www.primefaces.org/showcase-v8/ ... menu.xhtml
Best Regards,
Github Profile: https://github.com/mertsincan
I´ve tried that:
But it´s not working....
I short example would be great...
Also can I ?
a) Create the whole <pm:tabMenu based on backend bean? ( I will create pm:tab <pm:menu / p:submenu / p:menuitem from backend?
b) create only the menu items in a <pm:tab?
Code: Select all
import org.primefaces.model.menu.DefaultMenuItem;
import org.primefaces.morpheus.component.Menu;
@ViewScoped
@Named
public class LeftMenuController implements Serializable {
private static final long serialVersionUID = 2815796004558360299L;
private final Logger LOGGER = LoggerFactory.getLogger(LeftMenuController.class);
private Menu model = new Menu();
@PostConstruct
public void init() {
DefaultMenuItem item = DefaultMenuItem.builder()
.value("External")
.url("http://www.primefaces.org")
.icon("pi pi-home")
.build();
model.getElements().add(item);
}
Code: Select all
<pm:tab icon="fa fa fa-tachometer"
title="TEST">
<pm:menu model="#{leftMenuController.model}" />
</pm:tab>
I short example would be great...
Also can I ?
a) Create the whole <pm:tabMenu based on backend bean? ( I will create pm:tab <pm:menu / p:submenu / p:menuitem from backend?
b) create only the menu items in a <pm:tab?
Primefaces 12.0, WildFly 21
Ok, I´ve created the menu, this works...
But it seems for: pm:tabMenu I cannot create a
model="#{myController.model}". Is this right?
If yes, would it be possible to add this also?
Code: Select all
private MenuModel model = new DefaultMenuModel();
@PostConstruct
public void init() {
DefaultMenuItem item = DefaultMenuItem.builder()
.value("External")
.url("http://www.primefaces.org")
.icon("pi pi-home")
.build();
model.getElements().add(item);
DefaultSeparator defaultSeparator = new DefaultSeparator();
defaultSeparator.setStyleClass("layout-submenu-title");
model.getElements().add(defaultSeparator);
}
model="#{myController.model}". Is this right?
If yes, would it be possible to add this also?
Primefaces 12.0, WildFly 21
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
Yes, right! We'll work on it and get back to you.
Best Regards,
Yes, right! We'll work on it and get back to you.
Best Regards,
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest