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>
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 <p:autoComplete>
component behavior. As we have set minQueryLength
to 2
, the query gets triggered only after typing a minimum...