Reputation: 153
I am trying to pass values to rich:popupPanel with rich:hashParam tag, here is my code
<h:commandLink value="Edit">
<rich:componentControl target="editPanel" operation="show">
<a4j:param noEscape="true" value="event" />
<rich:hashParam>
<a4j:param name="categoryId" value="#{ c.categoryId }" />
<a4j:param name="categoryName" value="#{ c.name }" />
<a4j:param name="categoryParent" value="#{ c.parent }" />
</rich:hashParam>
</rich:componentControl>
And here is my popup panel which user can do something
<rich:popupPanel id="editPanel" autosized="true">
<!-- how to get value of the rich:hashParam? -->
</rich:popupPanel>
I have referred the richfaces document and examples about rich:hashParam to find out how to get values within the rich:popupPanel. But it seems that the document contains few about rich:hashParam and the example is hard coded, not passed by rich:hashParam.
Document : Here
Example : Here
Does anyone have idea about this? Thanks in advance.
Upvotes: 0
Views: 1898
Reputation: 153
Well, I have solved this problem myself. Instead of passing parameters with rich:hashParam
, I passed parameters to the popup panel with a4j:param
and assign the value to a backing bean property. Then re-render an a4j:outputPanel
which displays the parameter values.
<h:form id="editDataForm">
<!-- server do something with the 'categoryId' parameter it gets -->
<a4j:commandLink action="#{ testBackingBean.editData }" value="Edit" render="dataContent" oncomplete="#{rich:component('editPanel')}.show()">
<a4j:param name="data" value="#{ c.categoryId }" assignTo="#{ testBackingBean.categoryId }"/>
</a4j:commandLink>
</h:form>
<!--...-->
<rich:popupPanel id="editPanel">
<a4j:outputPanel id="dataContent" layout="inline">
<h:outputText value="ID:"/>
<h:outputText value="#{ testBackingBean.dataToEdit.categoryId }"/>
</a4j:outputPanel>
</rich:popupPanel>
Upvotes: 1