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:
Code: Select all
<p:autoComplete value="#{searchManagedBean.selectedItem}"
minQueryLength="3" queryDelay="300" id="searchPojo"
completeMethod="#{searchManagedBean.search}" scrollHeight="300"
var="item" itemLabel="#{item.name}" itemValue="#{item}"
converter="item" forceSelection="true">
<p:column>
<p:commandButton title="Add" icon="cart-basket"
action="#{searchManagedBean.addToCart}"
styleClass="ui-button cart-button">
</p:commandButton>
</p:column></p:autoComplete>
JSF 2
Tomcat 6