Forums de discussion

Multiple PrimeFaces portlets

Tatiana Kulish, modifié il y a 10 années.

Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
Hi, I'm using primefaces 3.5 portlets. I have 2 very basic potrlets lineCart http://www.primefaces.org/showcase/ui/lineChart.jsf and TabView http://www.primefaces.org/showcase/ui/tabviewDynamic.jsf, each of them works fine separately. But as soon as i put both of them on the page, lineChart stops showing anything and in the console i see error "Uncaught TypeError: Cannot call method 'replace' of undefined ".
When i remove portlet TabView, LineChart works fine again.
I noticed same behavior with elements <p:clock/> and <p:tabView ...>.
If i put this 2 elements in one portlet, they works fine, but i need to have them in separate portlets and i really don't know how to fix this problem.

Thank you
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Can you post here your xhtml code snippets?

Perhaps you can try to generate an Id for each primefaces component with <portlet:namespace> prefixed in it.
Tatiana Kulish, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
here it is:

LineChart
 <!--?xml version="1.0"?-->

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head />
	<h:body>
	<h:form id="form2">
		<p:clock />
		<p:linechart id="linear" value="#{chartTestBean.linearModel}" legendPosition="e" title="Linear Chart" minY="0" maxY="10" style="height:300px" />   
    
     </h:form>
	</h:body>
</f:view>


TabView
<!--?xml version="1.0"?-->

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head />
	<h:body>
		<h:form id="form1">  
    <p:tabview id="tabView">  
  
        <p:tab id="tba1" title="Godfather Part I">  
            <h:panelgrid columns="2" cellpadding="10">  
               
                <h:outputtext value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.  
                    His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. T  
                    hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect,  
                    but given to ruthless violence whenever anything stands against the good of the family." />  
            </h:panelgrid>  
        </p:tab>  
  
        <p:tab id="tab2" title="Godfather Part II">  
            <h:panelgrid columns="2" cellpadding="10">  
                  
                <h:outputtext value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream.  
                In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy,  
                killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows." />  
            </h:panelgrid>  
        </p:tab>  
  
        
  
    </p:tabview>  
</h:form>  
	</h:body>
</f:view>


I didn't really get how i supposed to use <portlet:namespace>?
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Hi Tatiana,

sorry, I was wrong. Those id are automatically generated by Liferay Faces I guess.

What's your Liferay Faces version? Did you test this webapp in a non-portlet environment?
Tatiana Kulish, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
I use Liferay 6.1.1 jboss 7.1.1 and primefaces 3.5.
I didn't test it in non portlet environment.
My portlets is just examples from primefaces demo page, you can easily test them too. They works fine separately, but doesn't work together. Seems like problem comes from TabView, there is something what breaks other portlets, but i don't know if it is primefaces problem or liferay problem

Thank you
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Liferay Faces version?
Tatiana Kulish, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
Sorry, i'm not sure if that what you are asking for

my faces-config.xml looks like this:
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
	<lifecycle>
		<phase-listener>com.liferay.faces.util.lifecycle.DebugPhaseListener</phase-listener>
	</lifecycle>
</faces-config>
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Please, upload your portlet so we can check.
Tatiana Kulish, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
RE: Multiple PrimeFaces portlets
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Hi Tatiana,

Juan ask the right question regarding the Liferay Faces version. I took a look at the portlet you attached and I saw that your WEB-INF/lib folder had version 3.1.0-rc2 of Liferay Faces dependencies:

docroot/WEB-INF/liferay-faces-bridge-api-3.1.0-rc2.jar
docroot/WEB-INF/liferay-faces-bridge-impl-3.1.0-rc2.jar
docroot/WEB-INF/liferay-faces-portal-3.1.0-rc2.jar
docroot/WEB-INF/liferay-faces-util-3.1.0-rc2.jar

My best guess is that you created the portlets with Liferay IDE via the Liferay 6.1.1 Plugins SDK. The template projects inside that version of the Plugins SDK contain version 3.1.0-rc2 of those dependencies, so whenever you create a new portlet, you are starting with old stuff.

When you get a chance, please download the 3.1.2-ga3 version of the dependencies from the downloads page and replace the old versions.

Note that you will probably want to first DELETE the deployed portlets from tomcat/webapps so that you don't end up with both the old and new versions of the dependencies when you re-deploy the portlets.

Kind Regards,

Neil
Tatiana Kulish, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

New Member Publications: 6 Date d'inscription: 08/07/13 Publications récentes
Thank you very much.

You was right, it solved the problem
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: Multiple PrimeFaces portlets

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Glad to hear that it is working now. Thanks for using Liferay Faces. emoticon