-
1. RichFaces4 autocomplete incorrect display
ilya_shaikovsky Apr 13, 2011 6:34 AM (in response to edilmar)Your list containst not a Strings but some custom objects? In that case toString used to get string representation.
show the code please.
-
2. RichFaces4 autocomplete incorrect display
edilmar Apr 15, 2011 11:01 AM (in response to ilya_shaikovsky)My list is a List<String>, like this:
public List<String> lookupName(String className, String fieldCode, String fieldName, String lookupName) {
Query q = getEntityManager().createQuery("SELECT CONCAT(CONCAT(" + fieldName + ",'-')" + "," + fieldCode + ") " +
"FROM " + className + " " +
"WHERE UPPER(" + fieldName + ") like '" + lookupName.toUpperCase() + "%' " +
"ORDER BY 1");
q.setMaxResults(200);List<String> ret = q.getResultList();
return ret;}
Sometimes the autocomplete component displays right, sometimes wrong, it has a unstable behaviour.
-
3. RichFaces4 autocomplete incorrect display
nbelaevski Apr 15, 2011 5:01 PM (in response to edilmar)Edilmar,
Can you please post page code?
-
4. Re: RichFaces4 autocomplete incorrect display
edilmar Apr 15, 2011 6:20 PM (in response to nbelaevski)Hi,
Here is the code for autocomplete:
<a4j:region id="a4j_Proprietario_cidade">
<rich:autocomplete id="Proprietario_cidade"
value="#{proprietario.entity.cidade}"
mode="cachedAjax" minChars="1" status="statusProprietario_cidade"
showButton="true" autocompleteMethod="#{proprietario.cidadeLookup}"
readonly="false" required="true" requiredMessage="Campo Cidade obrigatório na tabela .">
<f:converter converterId="cidadeConverter"/>
</rich:autocomplete>
<a4j:status id="statusProprietario_cidade" forceId="true">
<f:facet name="start">
<h:graphicImage value="/imagens/processar.gif"/>
</f:facet>
</a4j:status>
</a4j:region>
The method cidadeLookup calls the generic method lookupName that I wrote before, like this in my controller bean:
public List<String> cidadeLookup(String event) {
return dao.lookupName("Cidade", "codCidade", "nome", event.toString());
}
This code was the same that I used before with suggestionBox, and it never had problem with it. I just changed the component.
-
5. Re: RichFaces4 autocomplete incorrect display
ilya_shaikovsky Apr 18, 2011 4:44 AM (in response to edilmar)code looks fine.
need to check precise place where you could reproduce:
Sometimes the autocomplete component displays right, sometimes wrong, it has a unstable behaviour.
and check in debug which data returned in that cases.
-
6. Re: RichFaces4 autocomplete incorrect display
edilmar Apr 19, 2011 11:35 AM (in response to ilya_shaikovsky) -
7. Re: RichFaces4 autocomplete incorrect display
ilya_shaikovsky Apr 20, 2011 7:03 AM (in response to edilmar)could you please check if there are any styles which could affect positioning applied to components or the containers which wraps them?
would be great if you able to provide simplified complete page to reproduce that.
rf-showcase also contains few autocomplete components on the same page but has no such problem.
B.t.w. it works the same in all browsers for you?
-
8. Re: RichFaces4 autocomplete incorrect display
edilmar Apr 20, 2011 9:17 AM (in response to ilya_shaikovsky)I don't have any custom style, only default styles from RichFaces4 components.
The behaviour is the same in Firefox4 and Chrome10.
The strange is that sometimes if I type slowly, all works fine. But if I type very fast, positioning becomes crazy. I think navigators are not so fast to process the AJAX requests/responses.