I just upgraded from Primefaces 7.0 to Primefaces 8.0. I am seeing a duplicate header with a dataTable with StickyHeader inside a TabView when using the newer version. I did not see this behavior in 7.0. Isearched the forums and I did see a number of posts related to this issue. There is a solution posted by mertsincan on github (issue #1218) with a solution but it does not work. I downloaded the Primefaces showcase example and tried the solution posted by mertincan but it does not work. Below picture shows the behavior and I have an example file. I also checked all the link at github.com/primefaces/primefaces/… posted by Melloware on question Duplicate headers in primefaces data table
This is the same cars example from sticky on the showcase. Any direction/suggestions to fix this issue is very much appreciated.
Thanks
Below is the viewfile
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import com.example.model.Car;
import com.example.service.CarService;
@Named
@ViewScoped
public class ScrollView implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1472033438497912037L;
private List<Car> cars;
@Inject
private CarService service;
@PostConstruct
public void init() {
cars = service.createCars(50);
}
public List<Car> getCars() {
return cars;
}
public void setService(CarService service) {
this.service = service;
}
}
Below is the xhtml file. You can see the solution suggested by mertsincan on lines 10 and 11 in code : "mytabView.ui-tabs {position:static}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<style type="text/css">
.myTabview.ui-tabs {
position: static;
}
.noborders tr, .noborders td {
background: none !important;
border: none !important;
}
.negativeColor {
color: red;
}
.ui-datagrid-no-border>.ui-datagrid-content {
border: none !important;
}
</style>
</h:head>
<body>
<p:tabView id="CarsTabView" dynamic="false" cache="true" styleClass="myTabview">
<p:tab id="CarsTab" title="Cars">
<p:dataTable var="car" value="#{scrollView.cars}" stickyHeader="true">
<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>
</p:dataTable>
</p:tab>
</p:tabView>
</body>
</html>
This was introduced in PF 8.0 because of this ticket: https://github.com/primefaces/primefaces/issues/5429
Turns out zoom:1
was an old IE8 hack and since PF no longer supports IE8 we should not have converted it to transform: scale(1)
.
This will be fixed in PF Elite 8.0.2 with this ticket: https://github.com/primefaces/primefaces/issues/5675