Primefaces Collector + Edit行 - 布局中断

时间:2013-03-29 15:32:59

标签: jsf-2 primefaces

   <p:dataTable id="tableContas" value="#{extratoBancoController.contas}" var="entity" editable="true">
                <f:facet name="header">
                    <h:outputText value="Contas" />
                </f:facet>

                <p:ajax event="rowEdit"  listener="#{extratoBancoController.calcularValores()}" update=":mainForm:relatorios" process=":mainForm:relatorios" /> <!-- I tried with, and without process tag. Result is the same-->

                <p:column  style="width:80px">
                     <f:facet name="header">  
                        <h:outputText value="#{msg['entity.id']}" />  
                    </f:facet>  
                    <h:outputText value="#{entity.id}" />
                </p:column>

                                    <!-- Other columns here --> 

                <p:column sortBy="#{entity.valor}" headerText="#{msg['entity.valor']} (R$)">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{entity.valor}" style="float: right; padding-right: 50%;"/>                           
                        </f:facet>

                        <f:facet name="input">
                            <po:inputDinheiro id="inputValor" required="true" fieldId="valor" targetValue="#{entity.valor}" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>                     

                <p:column> 
                    <p:rowEditor  />  
                </p:column>

                <p:column>
                    <p:commandButton icon="ui-icon-minus" actionListener="#{extratoBancoController.calcularValores()}" update=":mainForm:relatorios" process=":mainForm:relatorios">
                        <p:collector value="#{entity}" removeFrom="#{extratoBancoController.contas}" />
                    </p:commandButton>
                </p:column>

                <f:facet name="footer">
                    <h:outputText
                        value="Total Entrada: R$ #{extratoBancoController.totalEntrada}" />
                    <h:outputText value=" - " />
                    <h:outputText
                        value="Total Saida: R$ #{extratoBancoController.totalSaida}" />
                </f:facet>

            </p:dataTable>

那么,发生了什么:

第1步:它在0的方位 img

步骤2:让我们点击铅笔图标,更改值并检查它! :) img

结果:在ajax之后,这就是数据表布局发生的事情: img

PS:值按预期更新,只是布局中断! :(

1 个答案:

答案 0 :(得分:1)

对不起伙计们......

您需要每次更新一个组件。我的意思是:

 update=":mainForm:tableContas :mainForm:painelRel" 

如果更新p:outputPanel,它会中断!