Colspan and rendered do not work in Subtable

Asked

Viewed 220 times

1

I have a Datatable with Subtable, I use Column renderings of both tables and colspan in some columns. Rendered and colspan tags in subtable do not work as expected.

Look at the code:

```


                            <p:columnGroup type="header">  
                                <p:row>  
                                    <p:column rowspan="2" colspan="3" headerText="Área Notificada" rendered="#{not empty relatoriosMB.listaObjeto1}"/>  
                                    <p:column colspan="#{relatoriosMB.countColumns}" headerText="Subclassificações" rendered="#{not empty relatoriosMB.listaObjeto1}"/>  
                                </p:row>  

                                <p:row>  
                                    <p:column headerText="JAN" style="width:50px;text-align: center" rendered="#{relatoriosMB.janeiro}"/> 
                                    <p:column headerText="FEV" style="width:50px;text-align: center" rendered="#{relatoriosMB.fevereiro}"/>
                                    <p:column headerText="MAR" style="width:50px;text-align: center" rendered="#{relatoriosMB.marco}"/> 
                                    <p:column headerText="ABR" style="width:50px;text-align: center" rendered="#{relatoriosMB.abril}"/>
                                    <p:column headerText="MAI" style="width:50px;text-align: center" rendered="#{relatoriosMB.maio}"/>
                                    <p:column headerText="JUN" style="width:50px;text-align: center" rendered="#{relatoriosMB.junho}"/>
                                    <p:column headerText="JUL" style="width:50px;text-align: center" rendered="#{relatoriosMB.julho}"/>
                                    <p:column headerText="AGO" style="width:50px;text-align: center" rendered="#{relatoriosMB.agosto}"/>
                                    <p:column headerText="SET" style="width:50px;text-align: center" rendered="#{relatoriosMB.setembro}"/>
                                    <p:column headerText="OUT" style="width:50px;text-align: center" rendered="#{relatoriosMB.outubro}"/>
                                    <p:column headerText="NOV" style="width:50px;text-align: center" rendered="#{relatoriosMB.novembro}"/>
                                    <p:column headerText="DEZ" style="width:50px;text-align: center" rendered="#{relatoriosMB.dezembro}"/>
                                    <p:column headerText="TOTAL" style="width:100px;text-align: center"/>
                                </p:row>  
                            </p:columnGroup>  

                            <p:subTable id="subTableDetalhe" var="detalhe" value="#{notificada.detalhe}">  
                                <f:facet name="header">  
                                    <h:outputText value="#{notificada.objeto}"/>  
                                </f:facet>  
                                <p:column colspan="3" >  
                                    <h:outputText value=" #{detalhe.objeto}"/>  
                                </p:column>  
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.janeiro}" rendered="#{relatoriosMB.janeiro}"/>  
                                </p:column>  
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.fevereiro}" rendered="#{relatoriosMB.fevereiro}"/>  
                                </p:column>  
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.marco}" rendered="#{relatoriosMB.marco}"/>  
                                </p:column>  
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.abril}" rendered="#{relatoriosMB.abril}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.maio}" rendered="#{relatoriosMB.maio}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.junho}" rendered="#{relatoriosMB.junho}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.julho}" rendered="#{relatoriosMB.julho}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.agosto}" rendered="#{relatoriosMB.agosto}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.setembro}" rendered="#{relatoriosMB.setembro}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.outubro}" rendered="#{relatoriosMB.novembro}"/>  
                                </p:column>
                                <p:column>  
                                    <p:outputLabel value="#{detalhe.dezembro}" rendered="#{relatoriosMB.dezembro}"/>  
                                </p:column>
                                <p:column>
                                    <p:outputLabel value="#{detalhe.totalLinha}"/>
                                </p:column>
                                <p:columnGroup type="footer">  
                                    <p:row>  
                                        <p:column colspan="3" style="text-align:right" footerText="Total Subclassificações:" />
                                        <p:column exportable="#{relatoriosMB.janeiro}"
                                            footerText="#{notificada.totalJaneiro}" rendered="#{relatoriosMB.janeiro}" />
                                        <p:column exportable="#{relatoriosMB.fevereiro}"
                                            footerText="#{notificada.totalFevereiro}" rendered="#{relatoriosMB.fevereiro}"/>
                                        <p:column exportable="#{relatoriosMB.marco}"
                                            footerText="#{notificada.totalMarco}" rendered="#{relatoriosMB.marco}"/>
                                        <p:column exportable="#{relatoriosMB.abril}"
                                            footerText="#{notificada.totalAbril}" rendered="#{relatoriosMB.abril}"/>
                                        <p:column exportable="#{relatoriosMB.maio}"
                                            footerText="#{notificada.totalMaio}" rendered="#{relatoriosMB.maio}"/>
                                        <p:column exportable="#{relatoriosMB.junho}"
                                            footerText="#{notificada.totalJunho}" rendered="#{relatoriosMB.junho}"/>
                                        <p:column exportable="#{relatoriosMB.julho}"  
                                            footerText="#{notificada.totalJulho}" rendered="#{relatoriosMB.julho}"/>
                                        <p:column exportable="#{relatoriosMB.agosto}"
                                            footerText="#{notificada.totalAgosto}" rendered="#{relatoriosMB.agosto}"/>
                                        <p:column exportable="#{relatoriosMB.setembro}"
                                            footerText="#{notificada.totalSetembro}" rendered="#{relatoriosMB.setembro}"/>
                                        <p:column exportable="#{relatoriosMB.outubro}"
                                            footerText="#{notificada.totalOutubro}" rendered="#{relatoriosMB.outubro}"/>
                                        <p:column exportable="#{relatoriosMB.novembro}"
                                            footerText="#{notificada.totalNovembro}" rendered="#{relatoriosMB.novembro}"/>
                                        <p:column exportable="#{relatoriosMB.dezembro}"
                                            footerText="#{notificada.totalDezembro}" rendered="#{relatoriosMB.dezembro}"/>
                                        <p:column footerText="#{notificada.totalFooter}"/>
                                    </p:row>  
                                </p:columnGroup>  
                            </p:subTable>  
                        </p:dataTable>  

```

IMPORTANT: Note that the same rendered used in the footer and headers, which work perfectly, are declared on subTable record lines (where they do not work as expected).

and below the screen image:

https://www.filepicker.io/api/file/th53NS7DQhOzzH0stW3c

Any possible solution for this case? I use JSF 2.2 and primefaces 5.0

  • I upgraded the version of Primefaces to 5.2, but the problem still persists. I opened a Issue on this subject

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.