Primefaces p:datatable changing default message "No Records found."?

Asked

Viewed 2,211 times

2

And I have a p:datatable:

<p:dataTable var="ind" value="#{logIndPersistBean.list}" paginator="true" rows="10"
                        id="table"  rowStyleClass="odd-row, even-row">

                        <f:facet name="header">
                            Lista de Log
                        </f:facet>

                        <p:column headerText="Name" >
                            <h:outputText value="#{ind.name}"/>
                        </p:column>

                        <p:column headerText="Date" >
                            <h:outputText value="#{ind.date}" />
                        </p:column>

                        </p:column>

                </p:dataTable>

When I run a new search, if it does not return any records, the datatable displays the message "No Records found." , there’s some way that I don’t have to display this message, just the empty list ?

I know I just need to add emptyMessage="", but I want to change the default message, i.e., instead of "No Records found." to "Your search has returned nothing" or simply "".

Is there any way to change this default message ?

I’m using 4.0 primefaces.

enter image description here

Thanks in advance !

2 answers

1


With this CSS you make the default line disappear:

.ui-widget-content .ui-datatable-empty-message{
   display: none;
}

There is no easy way to change the default message without changing the Primefaces source code, only with small hacks'.

  • Thank you, your solution worked perfectly !

1

"Simple "my brother, just insert in your datatable emptyMessage Inside emptyMessage you place the message you want. example

<p:dataTable id="table" value="#{bean.list}" var="obj"  emptyMessage="Nenhum Registro Encontrado" style="width:100%">

Hug!

  • As he said in the question, he knows this alternative, but he wants to change the default message of the datatable component, not just the table he made.

  • I’m really sorry. This is not an easy task my friend, as our friend Rafael informed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.