0

I have this autocomplete that works very well except for it not setting the value parameter in the backing bean

value="#{marketLoader.invSelectedItem}"

But it will only show the correct items from the search. But clicking an item does not set the object (not string). in the backing bean. The marketLoader.completeItemtext will return a List in this case. Is there a reason for the setInvSelectedItem() method not being called? Do I need a converter for this to work?

<p:autoComplete id="drop" dropdown="true" value="#{marketLoader.invSelectedItem}" 
        completeMethod="#{marketLoader.completeItemtext}" 
        var="item" itemLabel="#{item.typeName}"/>

The complete method

private invTypes invSelectedItem;
public List<invTypes> completeItemtext(String query) {
        if (query.length() < 3) {
            return null;
        }
        List<invTypes> tmpList = listDBItem.stream().filter(p -> p.getTypeName().contains(query))
                .collect(Collectors.toList()); 

        return tmpList;
    }
user2130951
  • 2,601
  • 4
  • 31
  • 58
  • All probable causes are listed here http://stackoverflow.com/questions/2118656/commandlink-commandbutton-ajax-backing-bean-action-listener-method-not-invoked Your question does not contain sufficient information to point out a specific cause. Read the JSF wiki page how to get better answers quicker: http://stackoverflow.com/tags/jsf/info – BalusC Aug 26 '15 at 10:37
  • Added some more info. Do I need a converter to be able to do this? – user2130951 Aug 26 '15 at 10:40
  • Yes you need a converter. I recommand to check the ready-to-user Omnifaces' converter (here: http://showcase.omnifaces.org/converters/ListConverter) – Mathieu Castets Aug 26 '15 at 12:21
  • check this: [link], I see that left converter http://stackoverflow.com/questions/32059695/autocomplete-primefaces-not-record-to-database – John Lopez Aug 27 '15 at 14:28

1 Answers1

0

You are missing a converter in order to set the selected value correctly. See this.

Bruno Caceiro
  • 7,035
  • 1
  • 26
  • 45