Passing JS Params to Dialog

UI Components for JSF
Post Reply
rich2prime
Posts: 4
Joined: 20 May 2011, 21:32

23 May 2011, 17:34

Hello Team.

I am a richfaces guy, and started using primefaces on my new project. The transition is really interesting and fun, as I see a wealth of innovative components in here to choose from.

I wanted to use p:dialog in one of my pages and would like to know if there is a way I can pass the params onto this component, just as we do for rich:modalPanel.

Code: Select all

    <rich:modalPanel onshow="alert(event.parameters.param1)"> 
where param1 is passed while calling the modalPanel.

So, is there something which I can use like this

Code: Select all

<p:carousel value="#{orderAction.photoIndex}" var="index" effect="easeInStrong" itemStyleClass="imageCarousel">
<p:commandLink oncomplete="dialog.show(#{index});" update="confirmGrid" title="Delete this Photo" />
</p:carousel>
where index is the integer value. I don't want to take the route of submitting it to the bean via setActionListener and then get it on the Dialog.

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

25 May 2011, 20:06

You can set the value you want to pass to the bean and use it in the dialog.Something like this

<p:commandLink id="displayDetails" immediate="true" oncomplete="productDialog.show()" update="dialogPanel">
<f:setPropertyActionListener value="#{product}" target="#{shopBean.selectedProduct}" />
</p:commandLink>

<p:outputPanel id="dialogPanel" >
<p:dialog id="nutritionForm" header="#{shopBean.selectedProduct.productName}" widgetVar="productDialog" closable="true" hideEffect="clip"
modal="true" draggable="true" width="900" height="600" resizable="true" zindex="1000" >

</p:dialog>

Hope this helps.
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests