Message Boards

sidenavSlider not getting initialized

Christopher Virtucio, modified 4 Years ago.

sidenavSlider not getting initialized

Junior Member Posts: 33 Join Date: 9/26/17 Recent Posts
Per the AUI documentation here (https://liferay.github.io/lexiconcss/content/sidenav/), a sidenav instance should have a sideNavigation() method. We query for this instance using jQuery on certain sites, and it does not appear to have it. This seems to mean that the sidenav instance is not getting initialized for some reason.
We need help debugging why this is the case. Liferay hid their repo for the product-navigation-menu (https://github.com/liferay/com-liferay-product-navigation) for some reason, so we have no way of looking at the source code.  There is one under modules (https://github.com/liferay/liferay-portal/blob/master/modules/apps/product-navigation/product-navigation-product-menu-web/src/main/resources/META-INF/resources/portlet/view.jsp#L65), but that only seems to be present in the master branch. We are currently on 7.0.x, which does not have that module.


This is causing issues for us, specifically because the product menu isn't working when it should. We tried replicating this behavior on a vanilla liferay instance with no customizations, but the sidenav instance gets initialized as normal, and the product navigation menu works as expected.


Any advice/direction would be greatly appreciated.

Thanks,

CJ
Christopher Virtucio, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Junior Member Posts: 33 Join Date: 9/26/17 Recent Posts
Did a lot of digging and found that the jquery from the Liferay Faces modules was messing with the jquery used by the sidenav menu. Specifically, I deployed a generated liferay faces archetype bundle to a vanilla liferay instance. The javascript events relevant for the sidenav menu were not getting emitted when the liferay faces-based portlet was deployed.
thumbnail
Neil Griffin, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi Christopher,
Are you using PrimeFaces? That's typically when JQuery is added as a client-side dependency. If so, I can share with you how to suppress it so that only one copy of JQuery is present on the portal page.
Kind Regards,
Neil
Christopher Virtucio, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Junior Member Posts: 33 Join Date: 9/26/17 Recent Posts
Neil Griffin:

Hi Christopher,
Are you using PrimeFaces? That's typically when JQuery is added as a client-side dependency. If so, I can share with you how to suppress it so that only one copy of JQuery is present on the portal page.
Kind Regards,
Neil

Hi Neil,

The generated archetype appears to use PrimeFaces. We do use PrimeFaces for our own portlet, as well.  We'd definitely appreciate information on suppressing the PrimeFaces jQuery.

Thanks for the response!

CJ
thumbnail
Neil Griffin, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
Hi CJ,
I just created a new jar module in a Git repo that will suppress the PrimeFaces supplied jquery.js resource (prevent it from being added to the portal page):https://github.com/ngriffin7a/jquery-resource-verifier
The README.md file provides a description of its purpose.Note that I got the idea from the class-level Javadoc description of ResourceVerifier.java in the com.liferay.faces.util module.Kind Regards,Neil
Christopher Virtucio, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Junior Member Posts: 33 Join Date: 9/26/17 Recent Posts
Neil Griffin:

Hi CJ,
I just created a new jar module in a Git repo that will suppress the PrimeFaces supplied jquery.js resource (prevent it from being added to the portal page):https://github.com/ngriffin7a/jquery-resource-verifier
The README.md file provides a description of its purpose.Note that I got the idea from the class-level Javadoc description of ResourceVerifier.java in the com.liferay.faces.util module.Kind Regards,Neil

That worked. Thank you, Neil.

CJ
thumbnail
Neil Griffin, modified 4 Years ago.

RE: sidenavSlider not getting initialized

Liferay Legend Posts: 2655 Join Date: 7/27/05 Recent Posts
It's my pleasure, CJ. Thanks for using Liferay Faces.