Fórumok

Using Partial Processing with Primefaces + Liferay

thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
Hi,

I am kind of building an example, wherein i am trying to use the Primefaces partial processing where selecting item from one box will refresh the items form the other box.

the code is as below,


<aui:layout id="l1">
		<h:form id="f1">
			<p:messages autoUpdate="true" />
			<aui:fieldset id="fs1">
				<aui:column id="c1a">
					<aui:field id="projectField" label="#{i18n['w7.mgmt.project']}">
						<p:selectonemenu id="project" label="#{i18n['w7.mgmt.project']}" required="true" value="#{w7ModelBean.project}">
							<f:selectitems value="#{w7ModelBean.projects}" />
							<f:ajax render="projectField" />
							<p:ajax event="change" listener="#{w7ModelBean.handleProjectChange}" update="envTypes" />
						</p:selectonemenu>
						<p:message id="projectFieldMessage" for="project" />
					</aui:field>
				</aui:column>

				<aui:column id="c1b">
					<aui:field id="envTypeField" label="#{i18n['w7.mgmt.environment.types']}">
						<p:selectonemenu id="envTypes" label="#{i18n['w7.mgmt.environment.types']}" required="true" value="#{w7ModelBean.envType}">
							<f:selectitems value="#{w7ModelBean.environmentTypes}" />
							<f:ajax render="envTypeField" />
						</p:selectonemenu>
						<p:message id="envTypeFieldMessage" for="envTypes" />
					</aui:field>
				</aui:column>
			</aui:fieldset>
		</h:form>
	</aui:layout>


But am always getting an error saying "Cannot find component with identifier "envTypes" referenced from "A4488:j_idt5:j_idt6:l1:f1:fs1:c1a:project"."

Can anyone tell me what is wrong with my approach ?

Thank you.

Kamesh
thumbnail
Juan Gonzalez, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Can you tell us your environment? (Liferay Faces and primefaces versions, etc)?

My guess is that you're using that code inside a NamingContainer.

EDIT: confirmed, AUI:Layout is a NamingContainer so you should reference id using the absolute path (not relative) for them (separate by semicolon ":").
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
Hi,

thanks for the response, I use Liferay Portal 6.1.1-ce-ga2 with Liferay Faces 3.1.2.ga3 and Prime faces 3.5

when you say absolute path you mean right form the form like l1:f1:fs1:c1b:envTypeField:envTypes( referring to the same code), but I tried doing it and kind of getting the same error message, I might be wrong though emoticon
thumbnail
Neil Griffin, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
If you prefix it with a colon, then it will start searching from UIViewRoot I believe, like this: ":l1:f1:fs1:c1b:envTypeField:envTypes"
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
I tried even doing that , for some reason its not able to pick the field up emoticon .. is there any other alternate way to make the refresh happen ?

In addition to this I am not able to cross refer the components using their ids,

e.g
UI Composition 1 - x.xhtml
------------------------------------
<h:form id="f1">
<p:treeTable id="x">
....

<p:ajax event="select" process="@form" update="f2:y"/>
</p:treeTable>
</h:form>

UI Composition 2 - y.xhtml
------------------------------------
<h:form id="f2">
<p:tabView id="y">
....
</p:tabView>
</h:form>

view.xhtml
--------------
...
<ui:include src="x.xhtml" />
<br/>
<ui:include src="y.xhtml" />
...

I then get the usual component not found error

Any thoughts .. i even tried using the binding attribute and get the id using the binding attribute still face the same issue.

--Kamesh
thumbnail
Juan Gonzalez, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Hi Kamesh,

I remember there was an issue when using components and referencing id with Primefaces (unfortunately I don't find the link to the Primefaces issue).

Please can you re-test the same but without using Primefaces? (only using <f:ajax/> and the like).
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
Hi Juan,

I see this problem coming only when i put my fileds within <aui:field/>, if I dont use the aui containers I am able to refer the id, but still sometime it gives an issue during hot deploy or refresh but it solved when I restart the server
thumbnail
Neil Griffin, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

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

I was able to reproduce the problem you mentioned regarding children of aui:field and realized that we might need to remove "implements UINamingContainer" from many of our components. Please see the thread titled Community Feedback Requested: Removing NamingContainer from aui: components for more info. The feedback we get on that thread will help us to determine the best course of action.

Thanks,

Neil
thumbnail
Bernd Prager, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Junior Member Bejegyzések: 42 Csatlakozás dátuma: 2012.12.20. Legújabb bejegyzések
How about putting the portlet namespace in your view?
<f:view xlmns="http://www.w3.org/1999/xhtml
  ...
  xmlns:portlet=" http: java.sun.com portlet"></f:view>

Now you have the portlet namespace availabe and can use it like this:
<p:commandbutton value="Submit" update="<portlet:namespace />:msgs" />
thumbnail
Vernon Singleton, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Expert Bejegyzések: 315 Csatlakozás dátuma: 2013.01.14. Legújabb bejegyzések
One of my guru friends says that you can do this:

<portlet:namespace var="namespace" />
<p:commandbutton value="Submit" update="#{namespace}:msgs" />


In order to allow Facelets to parse the view xhtml.
thumbnail
Juan Gonzalez, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Hi Kamesh,

good news! I finally managed to solve the issue.

It was simply a matter of prefixing the id with all the parent naming containers, so finally it looks like this:

<p:ajax event="change" listener="#{namingRequestBean.handleProjectChange}" update=":#{component.namingContainer.parent.namingContainer.clientId}:c1b:envTypeField" />


So the trick is this text:

#{component.namingContainer.parent.namingContainer.clientId}


I've attached a sample portlet with all the code (it's done from primefaces-portlet demo with few changes).

BTW, I couldn't make it work when updating envTypeField:envTypes.

Thanks!
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
That's ! awesome Juan emoticon thanks for the update. Let me check it out
thumbnail
Neil Griffin, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

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

Did the workaround provided by Juan help?

Thanks,

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

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 2655 Csatlakozás dátuma: 2005.07.27. Legújabb bejegyzések
Also, we recently closed FACES-1643 since we have decided to remove NamingContainer from aui: components in Liferay Faces 4.1.x/4.2.x. For more info, see: FACES-1688.
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
I haven't tried it, since it gave error earlier I did resort to the plain primefaces based ui and containers for my implementation. Will try and keep you posted

-Kamesh
thumbnail
Juan Gonzalez, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay (Válasz)

Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Hi Kamesh,

I tried more less the same test (using p:commandLink instead, but the component resolution process should be the same), and seems to be working using Primefaces 4.0 and latest Liferay Faces.

Can you check it?

Thanks!
thumbnail
Kamesh Sampath, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.05.27. Legújabb bejegyzések
Sorry for the delayed reply Juan, it did work with PrimeFaces 4. Thanks.
thumbnail
Juan Gonzalez, módosítva 10 év-val korábban

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend Bejegyzések: 3089 Csatlakozás dátuma: 2008.10.28. Legújabb bejegyzések
Thanks for confirming Kamesh,

could you mark the answer so anyone who reads this can see the solution quickly?

Thanks again.