Hi,
The Spark menus are not working after I have upgraded my project to Primefaces 6.2. The topmenu is rendered, but no dropdown elements are triggered on mouse click.
Is this something that can be easily fixed in the "layout.js" of Spark? I really would like to use the new 6.2 support for primefaces.MOVE_SCRIPTS_TO_BOTTOM
Chrome console log:
layout.js.jsf?ln=spark-layout:19 Uncaught TypeError: topmenuItems.size is not a function
at c.init (http://localhost:8080/javax.faces.resou ... yout:19:37)
at c.e.(anonymous function) [as init] (http://localhost:8080/javax.faces.resou ... =6.2:5:335)
at new c (http://localhost:8080/javax.faces.resou ... =6.2:5:437)
at Object.createWidget (http://localhost:8080/javax.faces.resou ... 6.2:1:4964)
at Object.cw (http://localhost:8080/javax.faces.resou ... 6.2:1:4785)
at http://localhost:8080/forum/topic/523:186:4
init @ layout.js.jsf?ln=spark-layout:19
e.(anonymous function) @ core.js.jsf?ln=primefaces&v=6.2:5
c @ core.js.jsf?ln=primefaces&v=6.2:5
createWidget @ core.js.jsf?ln=primefaces&v=6.2:1
cw @ core.js.jsf?ln=primefaces&v=6.2:1
(anonymous) @ 523:186
Spark menu not working with PF 6.2
Fixed this by doing the following:
1. Open your Spark layout.js (\src\main\webapp\resources\spark-layout\js\
2. Change line 19 from:
to
I guess this error occurred because PF 6.2 upgraded to the latest JQuery implementation. In the latest JQuery ".size()" has removed in favor for ".length"
If possible this should probably be put into a Spark patch?
1. Open your Spark layout.js (\src\main\webapp\resources\spark-layout\js\
2. Change line 19 from:
Code: Select all
for(var i=0; i<topmenuItems.size(); i++) {
Code: Select all
for(var i=0; i<topmenuItems.length; i++) {
If possible this should probably be put into a Spark patch?
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks a lot for the PR, please use the following code for now;
Code: Select all
/**
* PrimeFaces Spark Layout
*/
PrimeFaces.widget.Spark = PrimeFaces.widget.Spark.extend({
init: function(cfg) {
this._super(cfg);
this.menubar = $('#layout-menu');
this.topmenu = $('#layout-topbar-menu');
this.menumask = $('#menu-mask');
this.focusedLink = null;
this.focusedTopLink = null;
this.layoutMenuClick = false;
this.topbarMenuClick = false;
// for keyboard navigation
this.topmenu.attr('tabindex', '0');
var topmenuItems = this.topmenu.find('a');
for(var i=0; i<topmenuItems.length; i++) {
topmenuItems.eq(i).attr('tabindex', '-1');
}
this.bindEvents();
this.bindKeyEvents();
}
});
Could you please send an email to contact at primetek.com.tr?If possible this should probably be put into a Spark patch?
Github Profile: https://github.com/mertsincan
Email sent!
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks a lot!
Github Profile: https://github.com/mertsincan
-
- Posts: 23
- Joined: 06 Feb 2015, 20:34
This had been stumping me for a bit.
Thank you for the fix!
Thank you for the fix!
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks a lot for the update!
Github Profile: https://github.com/mertsincan
Hi @aragorn, I am having the same problem after upgrading to PrimeFaces 6.2.
I am currently using Spark Layout v2.1.1. I see on PrimeStore that v2.1.2 is available and it appears that its layout.js is using the new function you mentioned. Should I try to use v2.1.2 instead? Is it fully compatible with PF 6.2?
If so, then what I don't understand is why the Migration Update from v.2.1.1 to 2.1.2 doesn't mention anything about updating the layout.js file.
Thank you in advance.
I am currently using Spark Layout v2.1.1. I see on PrimeStore that v2.1.2 is available and it appears that its layout.js is using the new function you mentioned. Should I try to use v2.1.2 instead? Is it fully compatible with PF 6.2?
If so, then what I don't understand is why the Migration Update from v.2.1.1 to 2.1.2 doesn't mention anything about updating the layout.js file.
Thank you in advance.
PrimeFaces 8.0 | JSF 2.2 | Payara 5.194
PrimeNG 9.1.3 | Angular 9.1.12
PrimeNG 9.1.3 | Angular 9.1.12
It appears I was wrong. The 2.1.2 version is still using the old jQuery size() method. For the moment, I manually patched the layout.js file but I would like to make sure that this is the only compatibility issue.
Can someone confirm this? Why isn't there a PrimeFaces 6.2 compatible version of the Spark layout released yet?
Can someone confirm this? Why isn't there a PrimeFaces 6.2 compatible version of the Spark layout released yet?
PrimeFaces 8.0 | JSF 2.2 | Payara 5.194
PrimeNG 9.1.3 | Angular 9.1.12
PrimeNG 9.1.3 | Angular 9.1.12
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
We plan to release new Spark version in this week or next week.
Regards,
Regards,
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 2 guests