通过对话框组件更新SelectOneMenu primefaces组件
问题描述:
我正在通过对话框组件中的zip运行地址查找以刷新带有地址数据的表单。地址对象对所有信息都是正确的,但城市和邻居组件没有用适当的信息处理。只有国家组件加载通过对话框组件更新SelectOneMenu primefaces组件
选择组件依赖,州,市,邻里
页面地址
<h:form id="formEnd">
<p:panelGrid id="pnlEnderecoID" columns="2" layout="grid" columnClasses="ui-grid-col-2, ui-grid-col-5" styleClass="ui-panelgrid-blank">
<p:outputLabel value="Cep:"/>
<p:outputPanel>
<p:inputText id="iptCepID" value="#{funcionarioBean.endereco.cep}" style="width: 180px;">
<sgr:onlyNumber/>
</p:inputText>
<p:commandLink onclick="PF('cepDLG').show();" process="@this">
<span class="label label-primary"><i class="fa fa-search"></i></span>
</p:commandLink>
</p:outputPanel>
<p:outputLabel value="Estado:"/>
<p:selectOneMenu id="selectEstadoID" value="#{funcionarioBean.endereco.bairro.cidade.estado}" converter="omnifaces.SelectItemsConverter">
<f:selectItem itemLabel="Selecione" itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{funcionarioBean.listaEstados}" var="obj" itemLabel="#{obj.descricao}" itemValue="#{obj}"/>
<p:ajax listener="#{funcionarioBean.buscarCidadesPorEstadoSelecionado}" update="selectCidadeID"/>
</p:selectOneMenu>
<p:outputLabel value="Cidade:"/>
<p:selectOneMenu id="selectCidadeID" value="#{funcionarioBean.endereco.bairro.cidade}" converter="omnifaces.SelectItemsConverter">
<f:selectItem itemLabel="Selecione" itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{funcionarioBean.listaCidades}" var="obj" itemLabel="#{obj.descricao}" itemValue="#{obj}"/>
<p:ajax listener="#{funcionarioBean.buscarBairrosPorCidadeSelecionada}" update="selectBairroID"/>
</p:selectOneMenu>
<p:outputLabel value="Bairro:"/>
<p:selectOneMenu id="selectBairroID" value="#{funcionarioBean.endereco.bairro}" converter="omnifaces.SelectItemsConverter">
<f:selectItem itemLabel="Selecione" itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{funcionarioBean.listaBairros}" var="obj" itemLabel="#{obj.descricao}" itemValue="#{obj}"/>
</p:selectOneMenu>
</p:panelGrid>
</h:form>
<p:dialog header="Pesquisar CEP" widgetVar="cepDLG" modal="true" height="100">
<h:form id="formDLG">
<p:inputText id="iptCepWS" placeholder="Digite o CEP" value="#{funcionarioBean.endereco.cep}"/>
<p:commandButton
action="#{funcionarioBean.pesquisaCepComplementaEndereco}"
process="@this, iptCepWS"
update=":pnlEnderecoID"
style="width: 50px;"
icon="fa fa-search" oncomplete="PF('cepDLG').hide()"/>
</h:form>
</p:dialog>
通过对话
渲染formEnd后图片
答
我能够通过加载表单后加载城市和邻居列表来解决问题。谢谢你的帮助@Jaqen H'ghar
你可以尝试更新=“:formEnd:pnlEnderecoID”(或者只是“:formEnd”) –
请参阅https://*.com/questions/6045307/how-can -i-know-the-id-of-jsf-component-so-i-can-use-in-javascript effective'duplicate' – Kukeltje
感谢Jaqen H'ghar的回复。但是,我的问题形象的相同结果发生。我不了解这些从属组件中的这种行为 – EdeGerSil