June 2021
« Sep    
Your widget title

Archive for the ‘en-US’ Category

PostHeaderIcon (long tweet) When ‘filter’ does not work with Primefaces’ datatable


Sometimes, the filter function in Primefaces <p:datatable/> does not work when the field on which filtering is operated typed as an enum.


Actually, in order to filter, Primefaces relies on a direct '=' comparison. The hack to fix this issue is to force Primefaces to compare on the enum name, and not by a reference check.

Quick fix

In the enum class, add the following block:

public String getName(){ return name(); }

Have the datatable declaration to look like:

<p:dataTable id="castorsDT" var="castor" value="#{managedCastorListManagedBean.initiatedCastors}" widgetVar="castorsTable" filteredValue="#{managedCastorListManagedBean.filteredCastors}">

Declare the enum-filtered column lke this:

<p:column sortBy="#{castor.castorWorkflowStatus}" filterable="true" filterBy="#{}" filterMatchMode="in">
  <f:facet name="filter">
    <p:selectCheckboxMenu label="#{messages['status']}" onchange="PF('castorsTable').filter()">

      <f:selectItems value="#{transverseManagedBean.allCastorWorkflowStatuses}" var="cws" itemLabel="#{}" itemValue="#{}"/>

Notice how the filtering attribute is declared:

filterable="true" filterBy="#{}" filterMatchMode="in"

In other terms, the comparison is forced the rely on equals() of class String, through the calls to getName() and name().

PostHeaderIcon Jonathan LALOU recommends… Stephane TORTAJADA

I wrote the following notice on Stephane TORTAJADA‘s profile on LinkedIn:

I had reported to Stephane for one year. I recommend Stephane for his management, that is based on a few principles:
* understand personally technical and functional problems
* allow team mates to make errors, in order to learn from them
* protect team mates from external aggressions and impediments
* escalating up and down the relevant information

PostHeaderIcon Jonathan LALOU recommends… Ahmed CHAARI

I wrote the following notice on Ahmed CHAARI‘s profile on LinkedIn:

Ahmed has shown his ability to absorb and learn complex technologies, as well as improve his skills in a short time and a not-so-easy environment. This is why I consider Ahmed as a software engineer to recommend for any Java-focused team.

PostHeaderIcon Jonathan LALOU recommands… Sidney COHEN

I wrote the following notice on Sidney COHEN‘s profile on LinkedIn:

Sidney has a deep knowledge of the technologies he uses, such as Tibco systems. In several occasions, he was able to liaise with the key people of the right teams, perform the good actions and deliver the best solutions to various issues. Moreover, he has learnt complex Java technologies in a short time.
I recommend Sidney as a good worker and a friendly team mate


PostHeaderIcon Jonathan LALOU recommands… Yann BLAZART

I wrote the following notice on Yann BLAZART‘s profile on LinkedIn:

Yann has a wide knowledge in technologies, specifications and implementations of JEE. He has shown his ability to propose and implement technical solutions to various technical and functional issues and subjects. Besides, by helping his colleagues, he succeeded in raising the general level of the team. All this is why I recommend Yann as a Java developer and architect.