p:dataTable - how to customize text of "No records found."?

UI Components for JSF
Post Reply
rhume
Posts: 21
Joined: 07 Feb 2010, 07:30

15 Apr 2011, 22:34

I need to customize the "No records found." text in p:dataTable. Is there an easy way to do this?

Also, is this text translatable? I need to display an english and french version.

Thanks!

Rob

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

15 Apr 2011, 23:50

I assume you don't have the user's guide?

giberius
Posts: 42
Joined: 08 Jan 2011, 14:20

16 Apr 2011, 00:31

Use <p:dataTable emptyMessage="....."

You can localize messages by using message/resource bundles. Look on the internet how to do that. If you have set up you use something like this:

<p:dataTable emptyMessage="#{messagebundle.noRows"}

You will make message bundels for all the languages you need.

And.... just buy the manual, it really is not the price of the thing. Primefaces is a real nice set of open source components.

rhume
Posts: 21
Joined: 07 Feb 2010, 07:30

21 Apr 2011, 19:59

Thanks for the replies everyone. Very useful.

Optimus, yes I did buy the userguide. Thanks!

gollrich
Posts: 1
Joined: 27 Sep 2012, 13:46

27 Sep 2012, 13:49

Sorry for digging up this old thread.

Is there a way to customize the text for all dataTables eg. in the web.xml or faces.config ?
or do i have to change all tables separately ?

greetings michael

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

27 Sep 2012, 14:42

michal001 wrote:Also, is this text translatable? I need to display an english and french version.
Resource bundle internationalization..silly question :shock:

ohh..see it is replied in previous post also


@gollrich
you need to use emptyMessage attribute for all tables and you can give same styleclass for all tables to look like same through out all tables
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

arvidj
Posts: 3
Joined: 20 Jul 2012, 20:43

24 Oct 2012, 21:46

And to add on to this thread going down a parallel path ...

Is there a way to do parameter substitution on the message all within an EL expression in the error message.

What I would like to use is ...

Code: Select all

emptyMessage="#{messages.label_no_records_found}"
but instead of the

Code: Select all

"#{messages.label_no_records_found}"
some magic EL code that I have not been able to find after much searching so that a message in the properties file looks like this ...

Code: Select all

label_no_records_found=No {0} found
would end up looking like this "No Cars found" ... obviously "Cars" was the valuable of a variable made available to the EL expression.

Something that does the same as this ... but all in a one line expression as that is all that is available ...

Code: Select all

<h:outputFormat value="#{messages.label_no_records_found}" >
    <f:parm value="Cars" />
</h:outputFormat>
Thanks,
Arvid

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

25 Oct 2012, 09:32

Look people, Thread Necromancy is not approved of on this Forum.
If you have a question DON'T ASK IT IN A THREAD THAT IS 19 MONTHS OLD!!

Especially if that question has absolutely nothing to do with PrimeFaces: OP, go learn JSF.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

guntram
Posts: 1
Joined: 31 Mar 2017, 10:09

31 Mar 2017, 10:13

optimus.prime wrote:
15 Apr 2011, 23:50
I assume you don't have the user's guide?
This is the only correct answer!!! :mrgreen: \\n/

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests