Fórumok

Primefaces GMap not rendering

David Proba, módosítva 11 év-val korábban

Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
Hey guys,

I have trouble with Primefaces GMap.
As long as I was using PF 3.2, there was no problem with GMap, since updating to PF 3.3.1 and Liferay Faces 3.1 GMap is not rendering any more.
Is this a PF issue or a Liferay Faces issue ?

I am using PF 3.3.1 with Liferay 6.1 CE and Liferay Faces 3.1.

Thanks for your suggestions...
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
When you get a chance, please try to reproduce the problem with FireFox+FireBug and let me know if you see any JavaScript errors in the FireBug console. Thanks.
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
Hi Neil,

thx for your help. There are 2 things from Firebug:
  • $("script[src*=\"/javax.faces.resource/primefaces.js\"]").attr("src") is undefined - shown in console
  • GET http://maps.googleapis.com/maps/gen_204?ev=api_ads&cad=src:apiv3,ads:0 gets status 204 No Content - shown in network, graphics
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Do you have more than one PrimeFaces portlet on the portal page?
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
Yes, I have a couple of PF portlets on this page... Is this a problem ?
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Yes, due to PrimeFaces Issue#4093 there can be JavaScript conflicts with more than one PrimeFaces portlet on a single portal page.

When you get a chance, please try it with one PrimeFaces portlet and see if your JavaScript errors go away. Thanks.
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
Hi Neil,

do you know when this issue with multiple PF portlets will be done ?
Unfortunatly, it's a partial showstopper....

Best regards
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
I just committed a Liferay vendor-specific fix for FACES-1216. Please give it a try as soon as you can. You can download 3.1.0-ga1-SNAPSHOT artifacts from the snapshot repository.
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
Hi Neil,

thx for your help so far.
Actually, the problem with gmap still appears.

Currently, I use Liferay 6.1 GA1, Liferay Faces Bridge 3.1.0 GA1 and PF 3.3 with multiple portlets on a page.
Without Gmap portlet there is no js error displayed in console.
All other portlets (i.e. DataTable within Dialog) are working properly, but as soon as I deploy additionaly this one portlet including Gmap, I get "$("script[src*=\"/javax.faces.resource/primefaces.js\"]").attr("src") is undefined" error in console...
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Does it work OK if the gmap portlet is the only portlet on the portal page?
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
If GMap portlet is the only one, it works fine...
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Using the primefaces3-portlet demo, I added one p:gmap component tag (the same markup found in the GMap - Basic demo) to the view and I got the following JavaScript errors:

Uncaught ReferenceError: google is not defined


When I compared the <head>...</head> section of my Liferay Portal page to the GMap - Basic demo page, I found that the Google Maps JavaScript resource was not being loaded. When I added the following to the WEB-INF/liferay-portlet.xml descriptor, it started working:

<liferay-portlet-app>
	<portlet>
		...
		<header-portal-javascript>http://maps.google.com/maps/api/js?sensor=true</header-portal-javascript>
	</portlet></liferay-portlet-app>


It also worked with two p:gmap component tags on the page.
David Proba, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2011.06.27. Legújabb bejegyzések
This does not help.... I still get
TypeError: $("script[src*=\"/javax.faces.resource/primefaces.js\"]").attr("src") is undefined

... just like still using Liferay Faces 3.1 RC1.... in fact I am using GA1
thumbnail
Neil Griffin, módosítva 11 év-val korábban

RE: Primefaces GMap not rendering

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Hi David,

When you have time, could you start with a simple portlet project, and add the p:gmap component in such a way that it reproduces the problem?

If you are using the Liferay Maven SDK, then perhaps you could start with "mvn archetype:generate" and create a simple PrimeFaces 3 portlet from the list of archetypes. Note that you will have to modify the pom.xml in order to use the 3.1.1-ga1 version of Liferay Faces artifacts.

If you are using Liferay IDE 1.6.0, then you can do the same with File->New (Liferay Portlet). There is a new feature that lets you pick PrimeFaces when you are creating the project. See the screenshot in Greg Amerson's blog.

Neil