Time for action – selecting multiple items using AutoComplete
Let us see how to use the <p:autoComplete>
component with multiple selection:
- Create the new post form with the AutoComplete component to select multiple tags:
<p:autoComplete id="newPostTags" value="#{postController.newPost.tags}" completeMethod="#{postController.completeTag}" maxResults="10" minQueryLength="2" queryDelay="400" effect="slide" var="t" itemLabel="#{t.label}" itemValue="#{t}" converter="tagConverter" multiple="true"> </p:autoComplete>
What just happened?
We have used the <p:autoComplete>
component with multiple selection support by setting the multiple
attribute to true
. We have also used various other attributes such as maxResults
, minQueryLength
, queryDelay
, forceSelection
, and effect
to customize the <...