1
I got 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 does the research:
public void pesquisar() {
try {
lista = dao.findAll();
} catch (Exception e) {
e.printStackTrace();
}
}
The goal is that by loading the text into the dataTable
Make a check so that if there is any word in the text, the word is formatted, as in the example will be in bold. What I need is that every time the search button is triggered, before the data goes to dataTable
, are validated before, that is, as I call my method in outputText
?
Related question: http://answall.com/q/165762/132
– Victor Stafusa
@Victorstafusa I’m not very experienced yet on the site.. This has problem ?
– Roknauta
No, not a problem. The idea is to guide who will answer the question or then analyze it under some other aspect know where to look for more information.
– Victor Stafusa
I get it, thank you :)
– Roknauta