Quantcast
Channel: Programação - GUJ
Viewing all articles
Browse latest Browse all 33093

Dialog não abre após selecionar linha no DataTable - Primefaces

$
0
0

@Alexrochatsi escreveu:

Bom dia, estou tendo o seguinte problema:

Eu tenho um dataTable que é preenchido conforme os dados especificados na busca e até aqui esta funcionando, o problema esta justamente quando seleciono alguma linha do dataTable . Sempre que eu seleciono, o Dialog não abre de jeito nenhum. Fiz o teste sem usar o "disabled" e o mesmo abre, só não mostra as informações que deveriam ser carregadas do objeto selecionado. Segue o código abaixo para terem uma noção.

dataTable :

<p:dataTable id="pagamentosCartorio" var="pagamentos"
    paginator="true" rowsPerPageTemplate="10,15" rows="10"
    paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}{LastPageLink} {RowsPerPageDropdown}"
    paginatorPosition="bottom" widgetVar="tableUsuario"
    tableStyleClass="ui-table-columntoggle"
    emptyMessage="Não há pagamentos em aberto"
    style="text-align: center" sortBy="#{pagamentos.dataCadastro}"
    sortOrder="DESCENDING" value="#{pagamento.listaPagamentos}"
    selection="#{pagamento.pagamentoSelecionado}"
    rowKey="#{pagamentos.id}" selectionMode="single">
    <p:ajax event="rowSelect" update=":formCadastro:btnPagar" />
    <p:column headerText="Cartório" style="font-size: 1.1em" styleClass="Responsive" priority="3">
        <h:outputText value="#{pagamentos.cartorio.nome}" />
    </p:column>
    <p:column styleClass="Wid10 Responsive" headerText="Qtd. Boletos" sortable="true" priority="1">
        <h:outputText value="#{pagamentos.qtdBoletos}" />
    </p:column>
    <p:column headerText="Período" sortBy="#{pagamentos.periodo}" styleClass="Wid10 Responsive" priority="2">
        <h:outputText value="#{pagamentos.periodo}">
            <f:convertDateTime pattern="MM/yyyy" timeZone="GMT-3" />
        </h:outputText>
    </p:column>
    <p:column styleClass="Wid10 Responsive" sortBy="#{pagamentos.total}" headerText="Total" priority="1">
        <h:outputText value="#{pagamentos.total}">
            <f:convertNumber currencySymbol="R$" type="currency" />
        </h:outputText>
    </p:column>
    <p:column headerText="Data do Pagamento" sortBy="#{pagamentos.dataUltimoLogin}" styleClass="Wid20 Responsive" priority="2">
        <h:outputText rendered="#{pagamentos.dataPagamento != null}" value="#{pagamentos.dataPagamento}">
            <f:convertDateTime pattern="dd/MM/yyyy - HH:mm" timeZone="GMT-3" />
        </h:outputText>
        <h:outputText rendered="#{pagamentos.dataPagamento == null}" style="color:red" value="A PAGAR" />
    </p:column>
</p:dataTable>
<div class="Wid10 Fright" style="margin-right: 1%">
    <p:commandButton id="btnPagar" type="button" immediate="true"
   disabled="#{pagamento.pagamentoSelecionado.id == null and pagamento.pagamentoSelecionado.dataPagamento == null}" 
    styleClass="Wid100 Fs14 White RaisedButton Responsive"
    style="background-color: goldenrod" value="Pagar" icon="fa fa-dollar" onclick="PF('dlg2').show();" />
</div>

Dialog:

<p:dialog id="modalDialog" header="Forma de Pagamento"
	widgetVar="dlg2" modal="true" width="60%" height="400px"
	appendToBody="false" draggable="false" showEffect="puff"
	hideEffect="clip" closeOnEscape="true" resizable="false">
	<h:form id="formPagamentoCartorio" enctype="multipart/form-data">
		<p:growl id="growl2" autoUpdate="true" />
		<div class="container">
			<div class="EmptyBox10"></div>
			<div class="Container60 Responsive">
				<p:outputLabel value="Nome Cartório:" />
				<div class="EmptyBox5"></div>
				<div class="container100">
					<p:outputLabel style="color: red"
						value="#{pagamento.pagamento.cartorio.nome}" />
				</div>
			</div>
			<div class="Container20 Responsive">
				<p:outputLabel value="Período:" />
				<div class="EmptyBox5"></div>
				<div class="container100">
					<p:outputLabel value="#{pagamento.pagamento.periodo}"
						style="color: red">
						<f:convertDateTime pattern="MM/yyyy" timeZone="GMT-3" />
					</p:outputLabel>
				</div>
			</div>
			<div class="Container20 Responsive">
				<p:outputLabel value="Total a pagar:" />
				<div class="EmptyBox5"></div>
				<div class="container100">
					<p:outputLabel style="color: red"
						value="#{pagamento.pagamento.total}">
						<f:convertNumber currencySymbol="R$" type="currency" />
					</p:outputLabel>
				</div>
			</div>
			<div class="EmptyBox20"></div>
			<p:panel style="text-align:center">
				<div class="Container20 Responsive">
					<h:outputText value="Agência: "
						style="font-weight: bold; font-size: 1.2em" />
					<div class="EmptyBox5"></div>
					<div class="container100">
						<h:outputText style="font-size: 1.1em;color:blue"
							value="#{pagamento.pagamento.contaBancaria.agencia}" />
					</div>
				</div>
				<div class="Container30 Responsive">
					<h:outputText value="Conta Corrente: "
						style="font-weight: bold; font-size: 1.2em" />
					<div class="EmptyBox5"></div>
					<div class="container100">
						<h:outputText style="font-size: 1.1em;color:blue"
							value="#{pagamento.pagamento.contaBancaria.contaCorrente}" />
					</div>
				</div>
				<div class="Container50 Responsive">
					<h:outputText value="Banco: "
						style="font-weight: bold; font-size: 1.2em" />
					<div class="EmptyBox5"></div>
					<div class="container100">
						<h:outputText style="font-size: 1.1em;color:blue"
							value="#{pagamento.pagamento.contaBancaria.banco.nome}" />
					</div>
				</div>
				<div class="EmptyBox10"></div>
			</p:panel>
			<div class="EmptyBox20"></div>
			<p:panel header="Forma de Pagamento" styleClass="TexAlCenter"
				menuTitle="Forma de Pagamento">
				<div class="EmptyBox5"></div>
				<p:selectOneRadio id="formaPagamentoRadio"
					style="display: inline-table;"
					value="#{pagamento.pagamento.formaPagamento}">
					<f:selectItem itemLabel="TED" itemValue="1" />
					<f:selectItem itemLabel="DOC" itemValue="2" />
					<f:selectItem itemLabel="CHEQUE" itemValue="3" />
					<f:ajax event="click" render=":formPagamento" />
				</p:selectOneRadio>
				<p:outputLabel style="color: blue"
					rendered="#{pagamento.pagamento.valorCheque != null}"
					value="#{pagamento.pagamento.valorCheque}" />
				<p:inputMask mask="9999999" required="true"
					requiredMessage="Informe o número do cheque."
					style="text-transform: uppercase" placeholder="Ex: 4864786"
					rendered="#{pagamento.pagamento.formaPagamento == 3 and pagamento.pagamento.valorCheque == null}"
					value="#{pagamento.pagamento.valorCheque}" />
			</p:panel>
			<div class="EmptyBox20"></div>
			<div class="Wid20 Fright">
				<p:remoteCommand name="rcPagar"
					actionListener="#{pagamento.acaoAlterar}" />
				<p:commandButton type="button" resetValues="true"
					oncomplete=":formCadastro:pagamentos"
					styleClass="BlueButton Wid100 Fs14 White RaisedButton"
					onclick="rcPagar()" value="Pagar" icon="fa fa-dollar" />
			</div>
			<div class="EmptyBox20"></div>
		</div>
	</h:form>
</p:dialog>

Já viz de tudo e não consegui achar o problema. A questão principal é que sempre que o botão é clicado sem ter selecionado no dataTable o Dialog abre, mas quando seleciono a linha no dataTable aí que começa o problema. Se alguém puder me ajudar eu ficaria grato.

Mensagens: 1

Participantes: 1

Ler tópico completo


Viewing all articles
Browse latest Browse all 33093


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>