primefaces: DataTable : Sticky Header - cannot filter or sort on 7.0.RC1
1) Environment
-
PrimeFaces version: 7.0.RC1
-
Does it work on the newest released PrimeFaces? no, works on v6.2
-
Application server + version: WildFly 13
-
Affected browsers: Chrome/Firefox
2) Expected behavior
Datatable should be sortable and filterable
3) Actual behavior
Can’t sort or filter datatable
4) Steps to reproduce
Just create a datatable with stickyHeader=true
and add a sortBy
or filterBy
column.
5) Sample XHTML
<h:body>
<h:form>
<p:dataTable var="car" value="#{datatableView.cars}" stickyHeader="true" rows="15">
<p:column headerText="Id" sortBy="#{car.id}" filterBy="#{car.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>
<div style="min-height: 1500px"></div>
</h:form>
</h:body>
6) Sample bean
@Named
@ViewScoped
public class DatatableView implements Serializable {
private List<Car> cars;
private Car selectedCar;
private List<Car> filteredCars;
@Inject
private CarService carService;
@PostConstruct
public void init() {
cars = carService.createCars(30);
}
public boolean filterByPrice(Object value, Object filter, Locale locale) {
String filterText = (filter == null) ? null : filter.toString().trim();
if (filterText == null || filterText.equals("")) {
return true;
}
if (value == null) {
return false;
}
return ((Comparable) value).compareTo(Integer.valueOf(filterText)) > 0;
}
7) Sample maven project
Following is a sample project which reproduces described issue:
Changing the version of PrimeFaces to 6.2 removes the issue.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (18 by maintainers)
Commits related to this issue
- #4469 — committed to primefaces/primefaces by tandraschko 5 years ago
- #4469 — committed to primefaces/primefaces by tandraschko 5 years ago
I personally think the Sticky Header needs some love. There are about 10-15 open items here around Sticky Header.
In my company, we customized our stickyHeader so the paginator gets sticky also and we don’t face those issues. @Taichou I think we might need your brain on this one 😉