Avoid request to database if menu panel is not open

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

02 Apr 2020, 16:55

Hi all,

I have the following scenario:
I have in my left menu a p:repeat to get records from the database, like e.g. contacts as showing in the template page:
Image

Now I have the problem, that I will have for every page load a request to database, also if the menu is not collapsed.
But I need the request to the database only if I click e.g. on this menu panel:
Image

Otherwise my page is loading more than really needed.
Do you have any ideas how I can improve this?

Thank you
PF 8.0

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

03 Apr 2020, 11:56

Hi,

Thanks a lot for the screenshots. I added tabChange event to pm:tabMenu component on next version. You can use it for this issue.

Code: Select all

<h:form style="height: 100%">
    <pm:tabMenu id="tabMenu">
    
        <p:ajax event="tabChange" oncomplete="console.log('test')" />
        
        <pm:tab id="tab1" icon="fa fa-folder-open" title="FEATURES">
             ...
        </pm:tab>
        
...
        
Best Regards,

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

03 Apr 2020, 12:09

Wow, very great. Thank you very much.

Means the datatable is rendering and showing only if the specific menu is loaded?
Something like p:outputPanel deffered ?

At the end I need to load only p:datatable, list, content for the active pm:tab.
Caching would be also very nice, because I have for each p:menu item a security request, if user has the permission or not.

Any ideas?
PF 8.0

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

20 Apr 2020, 06:24

I think you can update content using <p:ajax event="tabChange".

Best Regards,

Post Reply

Return to “Morpheus - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests