Primefaces tooltip with image and filter in table

1

Hello

I have the following situation: a users table, and users have photos, I would like to move the mouse over the user name, present a tooltip of the primefaces with the image of the user, which is already happening.

The problem arises when we filter the table data, after filtering the image no longer appears.

Comments:

  • The image is being inserted through a StreamedContent object.
  • I've found some people are reporting problems with the filter being set null, so when filtering, it loses the reference of the data, even though I could not solve the problem, follow the link of the possible problem: http: / forum. primefaces.org/viewtopic.php?f=3&t=44524

Even following the steps mentioned, it did not work for me, however I believe this is the problem.

Any help is welcome.

<p:dataTable id="tableUsers" var="userTable" value="#{usersController.listUsers}" selection="#{usersController.selectedUsers}" filteredValue="#{usersController.filteredUsers}" rowKey="#{userTable.id}">
  
  <p:ajax event="filter" listener="#{usersController.onFilterTable}" />

  <p:column headerText="ID" sortBy="#{userTable.id}" filterBy="#{userTable.id}" filterMatchMode="exact">
    <h:outputText value="#{userTable.id}" />
  </p:column>

  <p:column headerText="Nome" sortBy="#{userTable.name}" filterBy="#{userTable.name}" filterMatchMode="contains">
    <h:outputLink id="content" value="#" style="text-decoration:none;">
      <h:outputText value="#{userTable.name}" style="z-index:1;" />
    </h:outputLink>
    <p:tooltip id="toolTipContent" for="content" position="bottom">
      <p:graphicImage id="imageThumbnail" cache="false" rendered="#{userTable.imageStreamed != null}" value="#{userTable.imageStreamed}" width="80" height="80" stream="false" />
      <h:outputText rendered="#{userTable.imageStreamed == null}" value="Sem foto" />
    </p:tooltip>
  </p:column>

</p:dataTable>

When filtering the table

public void onFilterTable(FilterEvent filterEvent) {
  System.out.println("Dados da pesquisa (filtro):");
  Set < String > keys = filterEvent.getFilters().keySet();
  for (String key: keys)
    System.out.println("Chave: " + key + " - Valor: " + filterEvent.getFilters().get(key));

  System.out.println("");
  List < Users > listFilteredUsers = (List < Users > ) filterEvent.getData();
  System.out.println("Lista de Usuários Filtrados: " + listFilteredUsers);
  if (listFilteredUsers != null)
    for (Users user: listFilteredUsers)
      System.out.println(user.getName() + " - StreamedContent: " + user.getImageStreamed());

  System.out.println("=================================================================");
  System.out.println("");
}

With the code above I get the following in the console

As you can see, the first query returns null (I do not know why, because it is a valid query, and on the screen it returns the data normally, only in Java it does not)

After this first null, all other data is returned but always in the backlog, for example, when a search is done that should return two users, it returns nothing, when I do another search, it returns the previous data and so on on the screen, but this only in Java, on the screen the search works normally (I did not understand this, in the back end the filter event returns me something and the screen happens again).

    
asked by anonymous 25.01.2017 / 18:21

0 answers