Time for action – using the ItemSelect and ItemUnselect events
Let us see how to use the AutoComplete component's itemSelect
and itemUnselect
events:
- Create a form with the AutoComplete component and register the
itemSelect
anditemUnselect
event listeners:<p:autoComplete id="newPostTags" value="#{postController.newPost.tags}" completeMethod="#{postController.completeTags}" maxResults="10" minQueryLength="1" queryDelay="400" var="t" itemLabel="#{t.label}" itemValue="#{t}" converter="tagConverter" multiple="true"> <p:ajax event="itemSelect" listener="#{postController.handleTagSelected}"/> <p:ajax event="itemUnselect" listener="#{postController.handleTagUnselected}"/> </p:autoComplete>
- Implement...