掲示板

Using Partial Processing with Primefaces + Liferay

thumbnail
10年前 に Kamesh Sampath によって更新されました。

Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
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
10年前 に Juan Gonzalez によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
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
10年前 に Neil Griffin によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
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
10年前 に Juan Gonzalez によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
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
10年前 に Neil Griffin によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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
10年前 に Bernd Prager によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Junior Member 投稿: 42 参加年月日: 12/12/20 最新の投稿
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
10年前 に Vernon Singleton によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Expert 投稿: 315 参加年月日: 13/01/14 最新の投稿
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
10年前 に Juan Gonzalez によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
That's ! awesome Juan emoticon thanks for the update. Let me check it out
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Hi Kamesh,

Did the workaround provided by Juan help?

Thanks,

Neil
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
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
10年前 に Juan Gonzalez によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay (回答)

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
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
10年前 に Kamesh Sampath によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Regular Member 投稿: 158 参加年月日: 10/05/27 最新の投稿
Sorry for the delayed reply Juan, it did work with PrimeFaces 4. Thanks.
thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: Using Partial Processing with Primefaces + Liferay

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Thanks for confirming Kamesh,

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

Thanks again.