1
My search field updates a selectManyMenu whenever something is typed in it
<p:inputText id="txtFiltroOrgaoDestino" value="#{mBManifestacao.txtFiltroOrgaoDestino}" style="width: 350px">
<p:ajax update="slcUnidadeTramite" event="keyup" global="false" listener="#{mBManifestacao.filtrarOrgaoDestino}" />
</p:inputText>
But when the field is released for editing it already comes with a text in it, and I would like it to filter at that time, because og need to go in the select field and give a space for example
I tried everything that is way I could imagine making the button that releases for editing perform an update in the field, but without success
<p:commandButton
update=":frmAdministrarManifestacao,
:frmEncaminharManifestacao,
:frmTramiteManifestacao"
process="@this, btnAnalisarManifestacao"
value="Analisar Manifestação" id="btnAnalisarManifestacao"
action="#{mBManifestacao.gravaStatusManifestacao()}">
<f:setPropertyActionListener
value="#{mBEnum.codStatusManifestacaoEM_ANALISE}"
target="#{mBManifestacao.manifestacao.stStatusManifestacao}" />
</p:commandButton>
Updating:
I managed, after much trying, to improve a little the situation and I no longer need to give the space, just by selecting the field it already runs the filter now:
<p:inputText id="txtFiltroOrgaoDestino" value="#{mBManifestacao.txtFiltroOrgaoDestino}" style="width: 350px">
<p:ajax update="slcUnidadeTramite" event="click" global="false" listener="#{mBManifestacao.filtrarOrgaoDestino}" />
<p:ajax update="slcUnidadeTramite" event="keyup" global="false" listener="#{mBManifestacao.filtrarOrgaoDestino}" />
</p:inputText>
You are setting the variable #{mBManifestacao.txtFiltroOrganDestino} to empty in the method #{mBManifestacao.gravaStatusManifestacao()}?
– Bonifacio
It is not precisely there that I attribute the text that I want it to begin
– Mateus
I don’t know if I explained myself well but I don’t want to clean the field but run the filtering of selectManyMenu
– Mateus
Got it. So why don’t you filter the result within the #{mBManifestacao.gravaStatusManifestacao()} method and update the target component? You do not need to wait for the value to reach the input to filter. Filter through the bean first.
– Bonifacio
True, I was so focused on making the button even though I didn’t think to make the bean, I’ll try here, thank you
– Mateus
Thank you @Bonifacio called the function filterOrgaoDestino() after setting the content and it worked perfectly
– Mateus
Excellent @Mateus! JSF should be able to assign the same behavior to multiple ajax events without creating multiple tags, but at least the problem has been solved.
– Bonifacio