0

I have a Web App that has a datatable where columns that do not have whitespace in the data sort fine, but columns that do have whitespace throw a javax.el.ELException / com.sun.el.parser.ParseException. e.g. Error Parsing: #{employee.Joe Bloggs}

To try to rule out my code I have set up a simpler example similar to https://www.logicbig.com/tutorials/misc/primefaces/data-table.html but the problem still persists

Is this a Primefaces limitation that you can not sort Strings that include whitespace? Or am I missing something?

e.g.

xhtml

<p:dataTable var="employee" value="#{employeeBean.employeeList}">
...
                    
    <p:column headerText="Name" sortBy="#{employee.name}" >
        <h:outputText value="#{employee.name}"/>
    </p:column>
                    
...
</p:dataTable>

Backing Bean

private List<Employee> employeeList = new ArrayList<Employee>(){{
      add(new Employee(1L,"Joe Bloggs","1234","Address"));
      add(new Employee(2L,"Test","1234","Address"));
}};
Llew
  • 21
  • 5
  • Something looks wrong `#{employee.Joe Bloggs}` is not a valid EL expression. I have never seen this before but its like `#{employee.name}` is somehow being expanded to `#{employee.Joe Bloggs}` – Melloware Dec 08 '20 at 14:47
  • If I change my data (remove whitespace) works OK, this can not be correct can it that whitespace is not allowed in a sort?: ```private List employeeList = new ArrayList(){{ add(new Employee(1L,"Joe","1234","Address")); add(new Employee(2L,"Test","1234","Address")); }};``` – Llew Dec 08 '20 at 19:15
  • No I have been using JSF/PrimeFaces for 10 years and I have never seen your issue. The white space should have nothing to do with it thats just the data. Can you try PF 7.0 or 8.0? – Melloware Dec 08 '20 at 19:27
  • Posted code is not correct. There is `sortBy` attribute of `p:column`, not sortby. – Vasil Lukach Dec 09 '20 at 19:28
  • Sorting in PrimeFaces works fine for columns with white spaced data. I have tons of examples where column data contains white spaces and all works absolutely correct. – Vasil Lukach Dec 09 '20 at 19:34
  • @VasilLukach sorry yes my actual code has sortBy not sortby – Llew Dec 10 '20 at 09:33

0 Answers0