1
I’m in trouble where mine dataTable
owns the property editable
set to true
. Allowing editing of the line the user selects.
Well, when putting a button to delete for example I’m having trouble that the edit button does not remain in the same line, giving a line break in it and leaving the two buttons at different levels.
And then I’d like to know what to do so I can line up, I’ve tried to put in a panelGrid
but there the rowEditor
crashing.
Code below:
<p:dataTable id="vigenciaCorrente" editable="true"
value="#{tabelaTaxaBean.pojo.vigenciaCorrente.faixas}"
var="corrente" sortBy="prazoMinimo">
<f:facet name="header">
<div align="left">
<p:outputLabel value="Vigência de " />
<p:outputLabel
value="#{tabelaTaxaBean.pojo.vigenciaCorrente.dataInicial}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:outputLabel>
<p:outputLabel value=" a "></p:outputLabel>
<p:outputLabel
value="#{tabelaTaxaBean.pojo.vigenciaCorrente.dataFinal}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:outputLabel>
<p:outputLabel value=" (vigência corrente)"></p:outputLabel>
</div>
</f:facet>
<p:column headerText="Prazo (em meses)">
<p:cellEditor>
<f:facet name="output">
<p:outputLabel
value="#{corrente.prazoMinimo} a #{corrente.prazoMaximo}" />
</f:facet>
<f:facet name="input">
<p:inputText label="Prazo inicial"
value="#{corrente.prazoMinimo}" size="8" maxlength="3"
onkeypress="mascara(this, soNumeros)" required="true" />
<p:inputText label="Prazo final"
value="#{corrente.prazoMaximo}" size="8" maxlength="3"
onkeypress="mascara(this, soNumeros)" required="true" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Taxa de juros">
<p:cellEditor>
<f:facet name="output">
<p:outputLabel value="#{corrente.taxaJuros}">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:outputLabel>
<p:outputLabel value="%" />
</f:facet>
<f:facet name="input">
<p:inputText label="Taxa de juros"
value="#{corrente.taxaJuros}"
onkeypress="mascara(this,valorMonetario)" size="11"
maxlength="6" required="true">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Taxa diferenciada para o banco/empresa">
<p:cellEditor>
<f:facet name="output">
<p:outputLabel value="#{corrente.taxaDiferenciadaParaBanco}">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:outputLabel>
<p:outputLabel value="%" />
</f:facet>
<f:facet name="input">
<p:inputText label="Taxa diferenciada para o banco/empresa"
value="#{corrente.taxaDiferenciadaParaBanco}"
onkeypress="mascara(this,valorMonetario)" size="11"
maxlength="6">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Comissão">
<p:cellEditor>
<f:facet name="output">
<p:outputLabel value="#{corrente.comissao}">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:outputLabel>
<p:outputLabel value="%" />
</f:facet>
<f:facet name="input">
<p:inputText label="Comissão" value="#{corrente.comissao}"
onkeypress="mascara(this,valorMonetario)" size="11"
maxlength="6" required="true">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Complemento">
<p:cellEditor>
<f:facet name="output">
<p:outputLabel value="#{corrente.complementoComissao}">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:outputLabel>
<p:outputLabel value="%" />
</f:facet>
<f:facet name="input">
<p:inputText label="Complemento"
value="#{corrente.complementoComissao}"
onkeypress="mascara(this,valorMonetario)" size="11"
maxlength="6">
<f:convertNumber locale="pt_BR" minFractionDigits="2"
maxFractionDigits="2" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Ação" style="width: 5%">
<p:rowEditor />
<p:commandButton update=":form:vigenciaCorrentePanel"
process=":form:vigenciaCorrentePanel" title="Excluir"
value="Excluir">
<p:collector
removeFrom="#{tabelaTaxaBean.pojo.vigenciaCorrente.faixas}"
value="#{corrente}" />
</p:commandButton>
</p:column>
<f:facet name="footer">
<div align="right">
<p:commandButton id="btnFaixaCorrente"
process="btnFaixaCorrente" value="Adicionar faixa"
update=":dialogAdicionarFaixa" oncomplete="dlgFaixa.show();">
<f:setPropertyActionListener
target="#{tabelaTaxaBean.vigenciaTipo}" value="corrente" />
</p:commandButton>
</div>
</f:facet>
</p:dataTable>
Dude, I’ll tell you that I don’t think anyone has this solution that you posted, because yesterday I Googled and I didn’t, could you please explain what your intentions are with these css. Thank you!
– Macario1983
@Macario1983 I added explanations to the answer. I also removed an attribute I had placed by mistake (test dirt). I hope it’s clear now. I didn’t search for a solution on the internet, I did using the Chrome editor on showcase of Primefaces. I’m used to it, because although PF is widely used, there are no solutions for many fine adjustments.
– utluiz
The only thing I noticed that after changing the delete button for a figure, they do not stay on the same level in height, I changed the vertical align to top and it worked... But it’s on! Thank you
– Macario1983