I have the following dataTable
:
<p:dataTable id="tabela" var="c" value="#{geracaomb.lista}" paginator="true" rows="10"
rendered="#{not empty geracaomb.lista}" paginatorPosition="top">
<p:column styleClass="botoesGrid">
<p:commandButton icon="ui-icon-pencil" action="#{geracaomb.editar(c.id)}" process="@this" update="cadastro,pesquisa"
ajax="false" />
<p:commandButton icon="ui-icon-trash" action="#{geracaomb.excluir(c)}" ajax="true" process="@this" update="pesquisa">
<p:confirm header="#{msg['cabecalho.apagar.registro']}" message="#{msg['apagar.registro']}" icon="ui-icon-alert" />
</p:commandButton>
<p:confirmDialog global="true" showEffect="exploud" hideEffect="fade">
<p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</p:column>
<p:column headerText="#{msg['nome']}" sortBy="#{c.nome}" style="width:12%;">
<h:outputText value="#{c.nome}" escape="false" />
</p:column>
And I have the following method:
public String checkTipo(String texto) {
List<TipoPokemon> lista = Arrays.asList(TipoPokemon.values());
String palavras[] = texto.split(" ");
for (int i = 0; i < lista.size(); i++) {
String tipo = lista.get(i).getNome().toLowerCase();
for (String palavra : palavras) {
if (palavra.toLowerCase().equals(tipo)) {
texto = texto.replace(palavra, "<b>"+palavra+"</b>");
}
}
}
return texto;
}
My method that performs the search:
public void pesquisar() {
try {
lista = dao.findAll();
} catch (Exception e) {
e.printStackTrace();
}
}
The goal is to load the text into dataTable
so that if there is any word in the text, the word is formatted, as the example will be in bold. What I need is that every time the search button is triggered, before the data goes to dataTable
, be validated before, that is, how do I call my method in outputText
?