After updating from PrimeFaces 8 to 10 all the autoComplete components in my application do not show values when opening the dropdown menu
The list stays empty. When I debug into AutoComplete and the AutoCompleteRenderer, I can see that the suggestions for an empty query are generated
But later in the AutoCompleteRenderer the AutoComplete is a new instance (with same component id) without any suggestions.
This is my JSF page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</h:head>
<h:body>
<h:form>
<p:autoComplete value="#{testBean.item}"
dropdown="true"
completeMethod="#{testBean.completeItems}"
var="item"
itemLabel="#{item}"
itemValue="#{iten}" />
<p:outputLabel value="Selected item: #{testBean.item}" />
</h:form>
</h:body>
</html>
and my bean
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.apache.commons.lang3.StringUtils;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@ManagedBean
@ViewScoped
public class TestBean {
private String item;
private final List<String> items = Arrays
.asList("item-0", "item-1", "item-2", "item-3", "item-4", "item-5", "item-6", "item-7", "item-8", "item-9");
public List<String> completeItems(final String query) {
return items.stream()
.filter(i -> StringUtils.containsIgnoreCase(i, query))
.collect(Collectors.toList());
}
}
Any ideas what I am doing wrong?
I found it. javax.faces.PARTIAL_STATE_SAVING
was set to false
. If I remove this in the web.xml
everything works fine.
This option was set before I joined the project and I can't find anything explaining why it was set to false.