Questions Tagged With autocompletehttps://answers.axonivy.com/tags/autocomplete/?type=rssquestions tagged <span class="tag">autocomplete</span>enWed, 12 Mar 2014 05:04:05 -0400how to use registered converter-class by converterId to use for p:autoComplete ?https://answers.axonivy.com/questions/571/how-to-use-registered-converter-class-by-converterid-to-use-for-p-autocomplete<p>for example I have a code below</p> <pre><code>&lt;p:autoComplete var="objTest" converter="objectConvert" dropdown="true" size="70" itemLabel="#{objTest.name}" global="false" itemValue="#{objTest}" completeMethod="#{logic.autoCompleteSelectObject}" forceSelection="true"&gt; &lt;/p:autoComplete&gt; </code></pre> <p>primeface get error :Could not find any registered converter-class by converterId How to register a converter-class in xpert ivy</p> <p>I tried with the sample in the primefacess showcase sample but it's not possible in xpert ivy class</p>toantpWed, 12 Mar 2014 05:04:05 -0400https://answers.axonivy.com/questions/571/how-to-use-registered-converter-class-by-converterid-to-use-for-p-autocompleteautocompletejsfprimefacesAutocomplete ignores itemValue attributehttps://answers.axonivy.com/questions/262/autocomplete-ignores-itemvalue-attribute<p>I'd like to build an input field with the autocomplete widget, so the user can search for one of our dealer locations.</p> <p>To do this, I've created a class <strong>Dealer</strong> and a class <strong>AutocompleteSource</strong> which should provide the data structure and the data itself. They look like this:</p> <p><strong>AutocompleteSource.java</strong></p> <pre><code>package ch.company.ivy.investitionsantrag; import java.util.ArrayList; import java.util.List; import ch.company.ivy.investitionsantrag.Dealer; import ch.ivyteam.ivy.environment.Ivy; import com.unboundid.ldap.sdk.LDAPConnection; import com.unboundid.ldap.sdk.LDAPException; import com.unboundid.ldap.sdk.LDAPSearchException; import com.unboundid.ldap.sdk.SearchResult; import com.unboundid.ldap.sdk.SearchResultEntry; import com.unboundid.ldap.sdk.SearchScope; public class AutocompleteSource { public LDAPConnection ldapServer; public AutocompleteSource() throws LDAPException { this.ldapServer = new LDAPConnection(Ivy.var().get("LDAPHost"), Integer.parseInt(Ivy.var().get("LDAPPort"))); ldapServer.bind(Ivy.var().get("LDAPUser"), Ivy.var().get("LDAPPassword")); } public List&lt;Dealer&gt; searchDealers(String query) throws LDAPSearchException { List&lt;Dealer&gt; dealers = new ArrayList&lt;Dealer&gt;(); SearchResult searchResult = this.ldapServer.search("dc=COMPANY,dc=CH", SearchScope.SUB, "(&amp;(|(imDealerNetwork=CHE001)(imDealerNetwork=CHE017)(imDealerNetwork=CHE003)(imDealerNetwork=CHE010))(|(cn=*" + query + "*)(imCity=*" + query + "*)))"); for (SearchResultEntry entry : searchResult.getSearchEntries()) { dealers.add(new Dealer(entry.getAttributeValue("cn"), entry.getAttributeValue("imCity"))); } return dealers; } } </code></pre> <p><strong>Dealer.java</strong></p> <pre><code>package ch.company.ivy.investitionsantrag; public class Dealer { public String id; public String city; public String label; public Dealer(String id, String city) { id = id.replaceFirst("^0+(?!$)", ""); this.id = id; this.city = city; this.label = id + " " + city; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } } </code></pre> <p>I've created a method <strong>dealers</strong> which takes the query string and executes the following code:</p> <pre><code>import ch.company.ivy.investitionsantrag.*; AutocompleteSource source = new AutocompleteSource(); in.dealers = source.searchDealers(in.query); </code></pre> <p>And finally, my call of the autocomplete in the view:</p> <pre><code>&lt;p:autoComplete id="dealer" completeMethod="#{logic.dealers}" required="false" var="dealer" itemLabel="#{dealer.label}" itemValue="#{dealer.id}" forceSelection="true" value="#{data.dealer}" /&gt; </code></pre> <p>The autocomplete works, it takes the query and gets the results from the LDAP server. But when I select one of the suggestions it puts the whole label into the input field instead of only the id. Am I doing something wrong?</p> <p><strong>Update</strong>: I just noticed that it in fact does use the value specified in <strong>itemValue</strong> - it's just in the background. Anyway to tell primefaces to make the visible value in the input field the same as in the background?</p>ahatiusSun, 19 Jan 2014 18:43:57 -0500https://answers.axonivy.com/questions/262/autocomplete-ignores-itemvalue-attributeautocomplete