Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay 7 GA7/Primefaces 6.2 datatable calendar filter popup issue
I'm having an issue with using a Primefaces popup calendar as a datatable filter. The popup works fine until I go to another page then come back. At that point the the popup will not display until I do a reload with my browser. I've added some javascript that automatically reloads the page once I click the page tab in Liferay but I'd rather not want to do that if possible. Any suggestion would be greatly appreciated.
Hi William,
Could you provide the
simplest code that reproduces your issue? Also, are you
navigating from edit mode to view mode or something like that? I’ve
seen issues when that happens since SennaJS cannot tell that
PrimeFaces is already loaded. Could you try turning
off SennaJS temporarily to see if that is causing the issue?
- Kyle
Turning SennaJS off corrects my issue. I did this by adding the following property to my portal-ext.properties file:
javascript.single.page.application.enabled=false
Is there any reason why I can't just leave it off permanently? I'm not using it. Does Liferay use it? Are there any other Liferay properties recommendations that you have if I'm using Primefaces.
Hi William,
You can turn off SennaJS permanently, but you may
lose some of the
SPA performance benefits. Everything should continue to work
correctly in your Portal though. You could also disable SennaJS for
your PrimeFaces portlet only (rather than turning it off for the whole
portal). That would allow other portlets to continue to benefit from
SennaJS even if your portlet cannot use it.
- Kyle
Kyle Joseph Stiemann:You can turn off SennaJS permanently, but you may lose some of the SPA performance benefits.
Well, I actually never saw a convincing test that Senna
actually has any performance benefits. The tests I saw so far at
Devcon just showed e.g. that Senna performs a lot better when the
Browser cache is disabled, because a lot of stuff isn't loaded twice.
But that's not a real life scenario. As far as I can tell, the same
stuff is loaded by the browser from the server with and without Senna.
So, there are no benefits there at all.
After pressing the issue in a discussion at Devcon, I was told that page rendering and subjective performance is better with Senna, well that's quite possible, but again: I never saw any measurements proofing that. And I'd dearly love to see measurements for that.
We had ALOT of issues with Senna in our projects and I am not sure if the feature is worth those troubles.
Thanks Christoph for your input on this issue.
I'm not doing SPA we use JSF to build our porlets. Is Liferay itself doing anything with SennaJS for its out of the box stuff?
Every portlet in Liferay (including core and custom portlets) automatically takes advantage of SennaJS. But it is only there to improve page load times. If you turn it off, it should not break anything as far as I know. Please report a bug in Liferay Portal (LPS) if something does break when you turn it off.
All I can say is that it was clearly interfering with some of the Primefaces components.
Thanks Kyle for input on this issue.
I am seeing an decrease in page loading speed without SennJS so I tried adding the following to my liferay-portlet.xml instead of turning SennaJS of completely:
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 7.0.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_7_0_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>packages</portlet-name>
<icon>/icon.png</icon>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<ajaxable>false</ajaxable>
<header-portlet-css>/resources/css/main.css</header-portlet-css>
<single-page-application>false</single-page-application>
</portlet>
<portlet>
But it caused the portlet not load and this exception in Liferay:
Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on
line 12 of document : The content of element type "portlet"
must match
"(portlet-name,icon?,virtual-path?,struts-path?,parent-struts-path?,configuration-path?,configuration-action-class?,indexer-class*,open-search-class?,scheduler-entry*,portlet-url-class?,friendly-url-mapper-class?,friendly-url-mapping?,friendly-url-routes?,url-encoder-class?,portlet-data-handler-class?,staged-model-data-handler-class*,template-handler?,portlet-layout-listener-class?,poller-processor-class?,pop-message-listener-class?,social-activity-interpreter-class*,social-request-interpreter-class?,user-notification-definitions?,user-notification-handler-class*,webdav-storage-token?,webdav-storage-class?,xml-rpc-method-class?,application-type*,control-panel-entry-category?,control-panel-entry-weight?,control-panel-entry-class?,asset-renderer-factory*,atom-collection-adapter*,custom-attributes-display*,permission-propagator?,trash-handler*,workflow-handler*,preferences-company-wide?,preferences-unique-per-layout?,preferences-owned-by-group?,use-default-template?,show-portlet-access-denied?,show-portlet-inactive?,action-url-redirect?,restore-current-view?,maximize-edit?,maximize-help?,pop-up-print?,layout-cacheable?,instanceable?,remoteable?,scopeable?,single-page-application?,user-principal-strategy?,private-request-attributes?,private-session-attributes?,autopropagated-parameters?,requires-namespaced-parameters?,action-timeout?,render-timeout?,render-weight?,ajaxable?,header-portal-css*,header-portlet-css*,header-portal-javascript*,header-portlet-javascript*,footer-portal-css*,footer-portlet-css*,footer-portal-javascript*,footer-portlet-javascript*,css-class-wrapper?,facebook-integration?,add-default-resource?,system?,active?,include?)".
Nested exception: The content of element type "portlet" must
match
"(portlet-name,icon?,virtual-path?,struts-path?,parent-struts-path?,configuration-path?,configuration-action-class?,indexer-class*,open-search-class?,scheduler-entry*,portlet-url-class?,friendly-url-mapper-class?,friendly-url-mapping?,friendly-url-routes?,url-encoder-class?,portlet-data-handler-class?,staged-model-data-handler-class*,template-handler?,portlet-layout-listener-class?,poller-processor-class?,pop-message-listener-class?,social-activity-interpreter-class*,social-request-interpreter-class?,user-notification-definitions?,user-notification-handler-class*,webdav-storage-token?,webdav-storage-class?,xml-rpc-method-class?,application-type*,control-panel-entry-category?,control-panel-entry-weight?,control-panel-entry-class?,asset-renderer-factory*,atom-collection-adapter*,custom-attributes-display*,permission-propagator?,trash-handler*,workflow-handler*,preferences-company-wide?,preferences-unique-per-layout?,preferences-owned-by-group?,use-default-template?,show-portlet-access-denied?,show-portlet-inactive?,action-url-redirect?,restore-current-view?,maximize-edit?,maximize-help?,pop-up-print?,layout-cacheable?,instanceable?,remoteable?,scopeable?,single-page-application?,user-principal-strategy?,private-request-attributes?,private-session-attributes?,autopropagated-parameters?,requires-namespaced-parameters?,action-timeout?,render-timeout?,render-weight?,ajaxable?,header-portal-css*,header-portlet-css*,header-portal-javascript*,header-portlet-javascript*,footer-portal-css*,footer-portlet-css*,footer-portal-javascript*,footer-portlet-javascript*,css-class-wrapper?,facebook-integration?,add-default-resource?,system?,active?,include?)".
I really hope you guys are paying attention to this SennaJS issue. I notice that it was the cause of the column toggler issue I was having as well.
Hi William,
The order of your XML elements is incorrect. I
believe it should look like this:
<span class="hljs-subst"><</span>portlet<span class="hljs-subst">></span>
<span class="hljs-subst"><</span>portlet<span class="hljs-attribute">-name</span><span class="hljs-subst">></span>packages<span class="hljs-subst"><</span>/portlet<span class="hljs-attribute">-name</span><span class="hljs-subst">></span>
<span class="hljs-subst"><</span>icon<span class="hljs-subst">></span>/icon<span class="hljs-built_in">.</span>png<span class="hljs-subst"><</span>/icon<span class="hljs-subst">></span>
<span class="hljs-subst"><</span>single<span class="hljs-attribute">-page</span><span class="hljs-attribute">-application</span><span class="hljs-subst">></span><span class="hljs-literal">false</span><span class="hljs-subst"><</span>/single<span class="hljs-attribute">-page</span><span class="hljs-attribute">-application</span><span class="hljs-subst">></span>
<span class="hljs-subst"><</span>requires<span class="hljs-attribute">-namespaced</span><span class="hljs-attribute">-parameters</span><span class="hljs-subst">></span><span class="hljs-literal">false</span><span class="hljs-subst"><</span>/requires<span class="hljs-attribute">-namespaced</span><span class="hljs-attribute">-parameters</span><span class="hljs-subst">></span>
<span class="hljs-subst"><</span>ajaxable<span class="hljs-subst">></span><span class="hljs-literal">false</span><span class="hljs-subst"><</span>/ajaxable<span class="hljs-subst">></span>
<span class="hljs-subst"><</span><span class="hljs-keyword">header</span><span class="hljs-attribute">-portlet</span><span class="hljs-attribute">-css</span><span class="hljs-subst">></span>/resources/css/main<span class="hljs-built_in">.</span>css<span class="hljs-subst"><</span>/<span class="hljs-keyword">header</span><span class="hljs-attribute">-portlet</span><span class="hljs-attribute">-css</span><span class="hljs-subst">></span>
<span class="hljs-subst"><</span>/portlet<span class="hljs-subst">></span>
Please see this documentation to determine the correct order of XML elements in the liferay-portlet.xml: https://docs.liferay.com/ce/portal/7.0-latest/definitions/liferay-portlet-app_7_0_0.dtd.html
If you are having a performance issue unrelated to Faces, consider posting on the more general Liferay Development forums: https://community.liferay.com/forums/-/message_boards/category/239390. Or, if you have a reproducer, perhaps post an issue: https://issues.liferay.com/secure/CreateIssue!default.jspa.
- Kyle
Changing the order of the tags did allow me to load my portlet but it did not fix the issue of the popup calendar working correctly. The only thing that seems to fix that is turning of Senna js for the entire portal. Doing that however really makes the performance of Liferay overall really bad. I'm definitely concerned about what other problems Senna Js is causing for my Primefaces portlets when its enabled.
If I can't find or get a suitable solution to this issue I'm may have to abandon the use of Liferay for this project an go with a straight web application. Having been a fan of Liferay for many years now I'd really hate to do that but I have to much effort invested into Primefaces code to want to change it.
Hi William,
I appreciate your frustration, but it will be
difficult for me to suggest an alternative fix for this issue without
some code that reproduces the problem. Turning off SennaJS for the
whole portal is a valid workaround (especially if nothing else works).
I'll take a look at this problem first thing on Wednesday to see if
there is a fix that can be applied only to your portlet, but it would
be easier with some simple code that
reproduces the issue.
- Kyle
Ok I'll get you something but an easy test would to see if a primefaces calendar is broken with senna. I'm specifically using it in a datatable as part of a column filter. But I'll build a quick portlet first which just contains the popup calendar.
I was hoping to help you guys get some DXP license sales with this project. I did that on my last two projects at previous employers.
Hi Kyle,
I've attached a portlets.zip file to this reply which contains two maven portlet projects, TestCalendar and TestCalendar2. TestCalendar is pretty simple being just a JSF view with a Primefaces calendar on it. The second portlets a little more involved being that it uses a Primefaces calendar as a datatable filter. This more closer to what I'm actually doing. To recreate the issue I did the following with javascript.single.page.application.enabled=true:
1. In the default Liferay site create two pages and deploy each portlet to one of the pages
2. Go to the first page and validate the that the popup calendar displays
3. Go to the second page and validate the that the popup calendar displays
4. Do a browser reload on the first page and validate the that the popup calendar displays
5. Go back to the second page and validate the that the popup calendar does not display.
6. Go back to the first page and validate the that the popup calendar does not display.
If I restart Liferay with javascript.single.page.application.enabled=false and re-perform my steps above the popup calendars never fail to display.
Thanks for the the excellent steps to reproduce, William. I believe
that you are running into FACES-3175. I
believe I have fixed the issue in Bridge Ext locally. Can you try out
the attached
com.liferay.faces.bridge.ext-5.0.3-SNAPSHOT.jar
(sha256
ba0a2d21da2dea02aceeaa30fd7c20d12af18b28e0a19ab18652e0bf5ad06a0f
)
and see if it fixes your issue?
If you want, you can install the SNAPSHOT
into your
local maven repository (under
~/.m2/repository/
) with the following command:
mvn install:install-file -Dfile=~/Downloads/<span class="hljs-keyword">com</span><span class="hljs-preprocessor">.liferay</span><span class="hljs-preprocessor">.faces</span><span class="hljs-preprocessor">.bridge</span><span class="hljs-preprocessor">.ext</span>-<span class="hljs-number">5.0</span><span class="hljs-number">.3</span>-SNAPSHOT<span class="hljs-preprocessor">.jar</span> -DgroupId=<span class="hljs-keyword">com</span><span class="hljs-preprocessor">.liferay</span><span class="hljs-preprocessor">.faces</span> \
-DartifactId=<span class="hljs-keyword">com</span><span class="hljs-preprocessor">.liferay</span><span class="hljs-preprocessor">.faces</span><span class="hljs-preprocessor">.bridge</span><span class="hljs-preprocessor">.ext</span>-Dversion=<span class="hljs-number">5.0</span><span class="hljs-number">.3</span>-SNAPSHOT -Dpackaging=jar
Then you can reference it in your
pom.xml
like so:
<span class="hljs-tag"><<span class="hljs-title">dependency</span>></span>
<span class="hljs-tag"><<span class="hljs-title">groupId</span>></span>com.liferay.faces<span class="hljs-tag"></<span class="hljs-title">groupId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">artifactId</span>></span>com.liferay.faces.bridge.ext<span class="hljs-tag"></<span class="hljs-title">artifactId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">version</span>></span>5.0.3-SNAPSHOT<span class="hljs-tag"></<span class="hljs-title">version</span>></span>
<span class="hljs-tag"><<span class="hljs-title">scope</span>></span>runtime<span class="hljs-tag"></<span class="hljs-title">scope</span>></span>
<span class="hljs-tag"></<span class="hljs-title">dependency</span>></span>
Hi Kyle,
I put in the new 5.0.3 bridge and everything works perfectly with javascript.single.page.application.enabled=true
Any idea when the 5.0.3 bridge will be official?
Thanks,
Bill
Unfortunately I'm still seeing issues like Primefaces context menus and column tooglers bleeding on to other pages. Anyway we can get that fixed in the bridge as well?
Attachments:
Hi William, you are running into a design incompatibly described in detail on StackOverflow and in FACES-2677. For now, you can try the workarounds that are listed there, but I am trying to come up with a simple solution that doesn't require workarounds (or changes to PrimeFaces). I'm going to test it soon (hopefully this week or next week). We're committed to making SennaJS work seamlessly with JSF and PrimeFaces as best we can, so if that fix works, I'll talk to Neil about releasing a new version of Bridge Ext in August. I'll keep you posted on this thread.
This is great to hear Kyle. We look forward to the new bridge. Thanks again for all your work on this issue.
Hi William, I believe I've fixed the issue you
mentioned where PrimeFaces markup appears after SennaJS
navigation. Can you test things out with the attached version of
Bridge Ext (sha256sum
62e52ebc030521fb21f2e3793b94e4694010a43e489b8b62987109dabc7d6b54
)
and let me know if it fixes things for you?
Hi Kyle,
I downloaded the attached 503 bridge ext you provided and deployed it with my portlets. It appears to fixed the issue I described earlier when I have single page app enabled, so that's a good thing.
However I am experiencing an issue with this 503 bridge ext that I don't have with the 502 bridge ext. When I double click a selectable row that I have in a datatable I'm seeing the following in the console:
21:16:36,424 ERROR [ExceptionHandlerBridgeImpl:81]
Unexpected error restoring state for component with id
_addextractionfields_WAR_IM_Portlets_:j_idt60. Cause:
java.lang.NullPointerException: Argument Error: Parameter family
is null.
I seen this on multiple portlets that have selectable datatables on them. In some cases it seems to be breaking some server side JavaScript class I'm trying to make as well.
Again this error only comes up with the new 503 bridge ext and it occurs irregardless of single page app being enabled or not.
One other thing I was able to recreate this new exception in the second example portlet, TestCalendar2, that I sent to you earlier on this post
Sorry about that William, I accidentally introduced a new bug. I
believe that I've fixed it. Can you try this Bridge Ext version
(sha256sum a231f05a8d83abaa3093841ba4bbad017e115d51c6e3a97c1840add5080419aa
)?
This fixes the exception but breaks the popup calendar
Thanks again for testing this William! Could you provide more info
such as steps to reproduce the problem on the attached TestCalendar
portlets? I couldn't reproduce any issues locally. And could you make
sure your browser cache is cleared before testing?
- Kyle
You are right Kyle! Clearing my cache is what I needed. Sorry I didn't think of that earlier. Everything seems to be working as expected. Popup calendars popup, column togglers and context menu don't bleed through to other pages and double clicking on selectable datatable rows work fine. I'll play with this a little more but right now it all looks good. Awesome!
So when will this new bridge ext be official?
Glad its working, William! Thanks so much for doing all this testing!
I'm starting to test Bridge Impl 4.1.2, Bridge Ext 5.0.3, and Portal
3.0.3 right now. I might be able to release by Friday, but if I can't
finish this week, I should be able to have a release done by the end
of next week (Aug. 24).
- Kyle
You're welcome Kyle and many thanks to you for working through this issue. It's much appreciated. We can definitely see the benefits of having SennaJs enabled in Liferay. Page loads are much faster and smoother with it.
Glad I could help! Just so you know, I'm still getting things ready for the release today, so the release should happen next week.
Hi William, we have delayed the release until Tuesday of next week since we need to test with Liferay Portal 7.1 + Fix Pack 1 which was just released this week. Apologies for the delay.
No problem. Thanks for the update.
Hi Kyle,
I'm just checking in on the of the new bridge extension. Any update on its release?
Thanks,
Bill
Hi Bill,
We've experienced a delay -- the release testing and release procedure will resume on-or-about September 12.
Thanks for your patience,
Neil
HI Neil,
Is there any update on the bridge extension release.
Regards,
Bill
Hi William,
Thanks for your patience throughout this release
process. I've just released Liferay Faces Portal 3.0.3, Bridge Impl
4.1.2, and Bridge Ext 5.0.3. They should be available in Maven Central
in the next few hours (I believe Bridge Ext 5.0.3 is already there). I
will provide more detailed release notes on my
blog today or Monday, so please check that out if you need more information.
- Kyle
Just updated to the new release and at first glance everything looks great! Thanks Kyle.
Glad to hear it William! Thanks for testing things for us. Here's the
full release announcement if you are interested: https://community.liferay.com/blogs/-/blogs/liferay-faces-released-with-liferay-portal-7-1-support-
Please let us know if there are any issues.
- Kyle
This issue has been corrected with the latest release of the lifefaces bridge:
https://community.liferay.com/blogs/-/blogs/liferay-faces-released-with-liferay-portal-7-1-support-?_com_liferay_blogs_web_portlet_BlogsPortlet_redirect=https%3A%2F%2Fcommunity.liferay.com%3A443%2Fblogs%3Fp_p_id%3Dcom_liferay_blogs_web_portlet_BlogsPortlet%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26_com_liferay_blogs_web_portlet_BlogsPortlet_cur%3D1%26_com_liferay_blogs_web_portlet_BlogsPortlet_delta%3D10
I had been looking for away to create a better page loading indicator and the article above showed how to modify the load indicator provided by Senna to be more in your face. The css provided worked perfectly.
Powered by Liferay™