command buttons inside Auto complete suggestions

UI Components for JSF
Post Reply
Posts: 5
Joined: 06 May 2013, 15:18

24 Jan 2014, 11:20

I am working for an e commerce project and trying to achieve below scenario using Autocomplete component.
Scenario: when user searchs, search results will appear in auto complete suggestions along with add button, clicking on that will add it to cart. I am able to populate the results however clicking on button is not triggering any action but instead it is selecting the item.
can anybody help in achieving this?

Code: Select all

<p:autoComplete value="#{searchManagedBean.selectedItem}"
						minQueryLength="3" queryDelay="300" id="searchPojo" 
						completeMethod="#{}" scrollHeight="300"
						var="item" itemLabel="#{}" itemValue="#{item}"
						converter="item" forceSelection="true">
							<p:commandButton title="Add" icon="cart-basket"
								styleClass="ui-button cart-button">
Primefaces 3.5.8
Tomcat 6
PrimeFaces 4.0 Tomcat 6 | Mojarra 2.1.11

User avatar
Expert Member
Posts: 2475
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE

24 Jan 2014, 15:29

You don't need the button, you can add the selected item to your cart in the complete method.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

Posts: 9
Joined: 14 Aug 2013, 08:26

18 May 2017, 15:40

I need to display many dynamic buttons on autocomplete , thats not working..

-> using composite component mojarra 2.3 and Prime 6.1.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests