question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DataTable: Cannot update footer only as initial footer is not rendered anymore

See original GitHub issue

1) Environment

  • PrimeFaces version: 7.0
  • Application server + version: Tomcat 8.5.37
  • Affected browsers: tested with Firefox and Edge

2) Expected behavior

<h:panelGroup id="buttonPanel"> component in <f:facet name="footer"> should be updateable (without updating the whole datatable) even if in the initial state all <p:commandButton> components are not rendered.

3) Actual behavior

I need to update the whole datatable to have an updated footer with buttons based on the selected row.

4) Steps to reproduce

Extend showcase Single with Row Click (https://www.primefaces.org/showcase/ui/data/datatable/selection.xhtml) by showing the button only if a row is selected. We therefore currently add a named container, e.g. h:panelGroup which can be separately updated and accordingly add row select and unselect events.

5) Sample XHTML

<p:dataTable id="singleDT" var="car" value="#{dtSelectionView.cars2}" selectionMode="single" selection="#{dtSelectionView.selectedCar}" rowKey="#{car.id}">
    <f:facet name="header">
        Single with Row Click
    </f:facet>
    <p:ajax event="rowSelect" update="buttonPanel" />
    <p:ajax event="rowUnselect" update="buttonPanel" />
    <p:column headerText="Id">
        <h:outputText value="#{car.id}" />
    </p:column>
    <p:column headerText="Year">
        <h:outputText value="#{car.year}" />
    </p:column>
    <p:column headerText="Brand">
        <h:outputText value="#{car.brand}" />
    </p:column>
    <p:column headerText="Color">
        <h:outputText value="#{car.color}" />
    </p:column>
    <f:facet name="footer">
        <h:panelGroup id="buttonPanel">
            <p:commandButton process="singleDT" update=":form:carDetail" icon="pi pi-search" value="View" oncomplete="PF('carDialog').show()" rendered="#{dtSelectionView.selectedCar != null}" />
        </h:panelGroup>
    </f:facet>
</p:dataTable>

6) Sample bean

unchanged to showcase.

This is probably caused by https://github.com/primefaces/primefaces/issues/2825. Our current solution still worked with PrimeFaces 6.1.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tandraschkocommented, Oct 21, 2020

i think the easiest way would be to add a attribute showEmptyFooter, which defaults to false?

0reactions
jansohncommented, Oct 21, 2020

I’m also for an attribute to switch between the two options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

api.column( 0 ).footer() not updating after initial draw
I've run into a strange issue where api.column( 0 ).footer().html() doesn't update after the initial table draw. If I change it to any...
Read more >
datatable jquery - table header width not aligned with body width
This problem occurs only in IE. My datatable code: $("#rates"). dataTable({ "bPaginate": false, "sScrollY": "250px", "bAutoWidth": false, "bScrollCollapse": ...
Read more >
Why can't I select and change the text in the footer?
Solution: If you can't directly edit footer text, it's probably the case that the footer placeholder has been turned off in Slide Master...
Read more >
Table Layouts - W3C
If a table contains multiple elements with 'display: table-footer-group', only the first is rendered as a footer; the others are treated as if...
Read more >
lightning-datatable - documentation - Salesforce Developers
Displaying and formatting of columns with appropriate data types; Infinite scrolling of rows; Inline editing for some data types; Header actions; Row-level ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found