Search code examples
primefaces

PrimeFaces dataTable filterBy not working if javax.faces.SEPARATOR_CHAR is changed


After updating from PrimeFaces 8 to 10 the filterBy in dataTable is not working anymore. I created a small test project and found out that if I removed the parameter javax.faces.SEPARATOR_CHAR, which was set to -, the filtering works fine again.

I don't understand why this parameter affects the table filtering.

Is there anything else that could cause the problem? Otherwise I would have to change all the uses of IDs in the project where the separator is used.

Here is my example project

<!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:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</h:head>

<h:body>
    <h:form>
        <p:dataTable var="item"
                     sortBy="#{item}"
                     value="#{testBean.items}">

            <p:column headerText="Item" filterBy="#{item}" filterMatchMode="contains">
                <p:outputLabel value="#{item}"/>
            </p:column>
        </p:dataTable>
    </h:form>
</h:body>
</html>
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import javax.faces.view.ViewScoped;
import javax.inject.Named;

import org.apache.commons.lang3.StringUtils;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Named
@ViewScoped
public class TestBean implements Serializable {

    private String item;

    private final List<String> items = Arrays
            .asList("item0", "item1", "item2", "item3", "item4", "item5", "item6", "item/", "item8", "item9");
}

Solution

  • As explained by @tandraschko and @Melloware, this was as bug in PF 10.0.0 and is fixed in v11.0.0.