DataTable: Cannot update footer only as initial footer is not rendered anymore
See original GitHub issue1) Environment
- PrimeFaces version:
7.0
- Application server + version:
Tomcat 8.5.37
- Affected browsers: tested with
Firefox
andEdge
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:
- Created 4 years ago
- Comments:13 (10 by maintainers)
i think the easiest way would be to add a attribute showEmptyFooter, which defaults to false?
I’m also for an attribute to switch between the two options.