Autocomplete with rendered properties don't works

UI Components for JSF
Post Reply
MayaraMT
Posts: 2
Joined: 26 Oct 2011, 20:43

26 Oct 2011, 20:51

I use the autocomplete component associated with the property rendered to a boolean field in my MBean.

However, when I submit the page, the field
still appeared on my screen (according to the field value
that used in the rendered), but lost the behavior of auto complete,
then, it worked like a inputText.

When I removed the property rendered, the component works
perfectly after submitting the page.

I tried to put the rendered in a panel component, but the problem of loss of the autocomplete behavior continues.

so, any idea?

MayaraMT
Posts: 2
Joined: 26 Oct 2011, 20:43

28 Oct 2011, 12:56

I tried with 3.0.M3 version and has the same problem.

//xhtml:

<h:outputText value="Atividade Econômica Principal:"
rendered="#{relatorioMBean.mostraAtividadeEconomica}" />


<p:autoComplete value="#{relatorioMBean.atividadeEconomicaSelecionada}"
rendered="#{relatorioMBean.mostraAtividadeEconomica}"
completeMethod="#{relatorioMBean.completaAtividadeEconomica}"
var="item" itemLabel="#{item.descricao}" style="width: 400px"
itemValue="#{item}" converter="IndexedConverter"/>


//MBean:

private AtividadeEconomica atividadeEconomicaSelecionada;
private boolean mostraAtividadeEconomica = true;


public boolean isMostraAtividadeEconomica() {
return mostraAtividadeEconomica;
}

public void setMostraAtividadeEconomica(boolean mostraAtividadeEconomica) {
this.mostraAtividadeEconomica = mostraAtividadeEconomica;
}

public AtividadeEconomica getAtividadeEconomicaSelecionada() {
return atividadeEconomicaSelecionada;
}

public void setAtividadeEconomicaSelecionada(AtividadeEconomica atividadeEconomicaSelecionada) {
this.atividadeEconomicaSelecionada = atividadeEconomicaSelecionada;
}

public List<AtividadeEconomica> completaAtividadeEconomica(String query) {

List<AtividadeEconomica> results = new ArrayList<AtividadeEconomica>();

for (AtividadeEconomica atv : atividadesEconomicasLst) {
if (atv.getDescricao().toUpperCase().indexOf(query.toUpperCase()) > -1) {
results.add(atv);
}
}

return results;
}

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 75 guests