Olá Pessoal,
Estou utilizando o componente p:dialog como popup e estou com o seguinte problema. Em telas em que utilizo o popup em um campo que não é o primeiro da tela, ao confirmar a seleção do popup a pagina e reinderizada apagando o conteudo dos campos anteriores. Como posso evitar isso ? Segue abaixo o código da página.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<ui:composition xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="../../../base.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="title">
</ui:define>
<ui:define name="topo">
</ui:define>
<ui:define name="content">
<script type="text/javascript" src="../../../resources/js/jquery.price_format.js"></script>
<h:body>
<p:panel style="width: 910px; margin: 0 auto; min-height: 500px; font-size: 12px">
<h:panelGrid columns="1" style="width: 100%;">
<ui:insert name="usuario">
</ui:insert>
<ui:insert name="conteudo">
<h:form id="fmEditar">
<p:focus for="idCodigo"/>
<p:panel header="Incluir item" style="background-color: #dddddd">
<table>
<tr>
<h:commandLink action="#{itemFace.doFinishCreateItem(usuarioFace.loggedUser.empresa.codigo)}" title="Salvar" id="bt_salvar">
<p:graphicImage value="#{pageContext.servletContext.contextPath}/resources/imagens/confirmar.png" width="20" height="20" alt="Salvar" />
</h:commandLink>
<h:commandLink immediate="true" action="#{itemFace.doListItens}" title="Cancelar" id="bt_cancelar">
<p:graphicImage value="#{pageContext.servletContext.contextPath}/resources/imagens/cancelar.png" width="20" height="20" alt="Cancelar" />
</h:commandLink>
</tr>
<tr>
<td>Código</td>
<td>
<p:inputText id="idCodigo" value="#{itemFace.selectedBean.codigo}" size="20"/>
</td>
</tr>
<tr>
<td>Descrição</td>
<td><p:inputText value="#{itemFace.selectedBean.descricao}" size="60"/></td>
</tr>
<tr>
<td>UN</td>
<td>
<h:selectOneMenu style="width: 300px" value="#{itemFace.selectedBean.unidademedida}">
<f:selectItems var="itemSel" itemLabel="#{itemSel.descricao}" itemValue="#{itemSel}" value="#{itemFace.allUnidadeMedida}"/>
<f:converter converterId="unidadeMedidaConverter"/>
</h:selectOneMenu>
<p:commandButton process="@this" type="button" value="..." onclick="dlgun.show()" style=" height: 25px; width:35px"/>
</td>
</tr>
<tr>
<td>Preço unitario </td>
<td>
<p:inputText value="#{itemFace.selectedBean.preco}" styleClass="monetario" style="text-align: right">
<f:convertNumber type="currency" locale="pt_BR"/>
</p:inputText>
</td>
</tr>
</table>
<p:messages/>
</p:panel>
</h:form>
</ui:insert>
</h:panelGrid>
</p:panel>
</h:body>
<p:dialog id="idPesquisa" widgetVar="dlgun"
header="Busca unidade de medida" width="525" height="400"
showEffect="explode" hideEffect="explode">
<h:form>
<p:dataTable var="item" value="#{unidadeMedidaFace.list}" paginator="true" rows="10"
selection="#{itemFace.selectedLinhaBuscaUn}"
selectionMode="single" onRowSelectUpdate="display"
emptyMessage="Não há registros a exibir"
style="font-size: 10px; background-color: lightblue">
<f:facet name="header">
Lista de unidades cadastradas
</f:facet>
<p:column sortBy="#{item.un}" filterBy="#{item.un}" style=" font-size: 10px" >
<f:facet name="header">
<h:outputText value="Unidade"/>
</f:facet>
<h:outputText value="#{item.un}"/>
</p:column>
<p:column sortBy="#{item.descricao}" filterBy="#{item.descricao}" style=" font-size: 10px">
<f:facet name="header">
<h:outputText value="Descrição"/>
</f:facet>
<h:outputText value="#{item.descricao}"/>
</p:column>
<p:column style="width:30px">
<f:facet name="header">
<h:outputText value="Ação" style="font-size: 10px"/>
</f:facet>
<h:commandLink title="Selecionar registro" action="#{itemFace.doConfirmaBuscaUn}" id="bt_confirmar" onclick="window.close();">
<p:graphicImage title="Selecionar registro" value="#{pageContext.servletContext.contextPath}/resources/imagens/confirmar.png"
width="15" height="15" alt="Selecionar registro" />
<f:setPropertyActionListener target="#{itemFace.selectedLinhaBuscaUn}" value="#{item}"/>
</h:commandLink>
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
<script type="text/javascript">
jQuery('.monetario').priceFormat({
prefix : 'R$ '
});
</script>
<script type="text/javascript">
jQuery('.decimal').priceFormat({
prefix : ' '
});
</script>
</ui:define>
</ui:composition>
</html>