autocomplete: display data on focus

UI Components for JSF
Post Reply
marten
Posts: 1
Joined: 29 Sep 2011, 13:27

29 Sep 2011, 13:43

Hello!

My users want autocomplete to display data onfocus.

Example:
1. user types in 'a' in autocomplete inpuptfield - selectable data starting with the letter 'a' is shown
2. user clicks outside autocomplete inpuptfield, removing focus from autocomplete - selectable data is hidden
3. user regains focus on autocomplete by clicking in autocomplete inputfield, the letter 'a' is still in the autocomplete inputfield - selectable data is NOT shown

On step 3 my users wants to see all selectable data directly without any extra typing.
Is there any solution available to show selectable data onfocus?

Im using:
Primefaces 2.2.1
JSF mojarra 2.02
Server Jetty 6.1.26 and Websphere Application Server 6.1

My code

Code: Select all

<p:autoComplete value="#{pdtDialog.selectedPdt}" id="autoCompletePDT"
	completeMethod="#{pdtDialog.completePdt}" 
	var="pdt" 
	itemLabel="#{pdt.functionGroup} - #{pdt.title}" 
	itemValue="#{pdt}">
</p:autoComplete>

Code: Select all

public List<PartDocumentTemplateBasicInfoDTO> completePdt(String query) {
	List<PartDocumentTemplateBasicInfoDTO> matchList = new ArrayList<PartDocumentTemplateBasicInfoDTO>();
		for (PartDocumentTemplateBasicInfoDTO pdt : pdts) {
			if (pdt.functionGroup.toString().contains(query) || pdt.title.toLowerCase().contains(query.toLowerCase())) {
				matchList.add(pdt);
			}
		}
	return matchList;
}

I'm thankful for any suggestions

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests