Issue with p:dataTable paginator and filtering

UI Components for JSF
Post Reply
slang2310
Posts: 13
Joined: 13 May 2015, 16:13

27 Nov 2015, 11:50

Hello,

I have standard lazy p:dataTable with pagination and filtering. Everything works fine until the filter removes all elements from the p:dataTable. Even though I can see that in my LazyEntityModel setRowCount is correctly set to "0", the paginator shows the following output: "0 - 50 of undefined". I would rather expect "0-0 of 0" or even better the paginator should disappear in case of zero elements. Setting paginatorAlwaysVisible="false" is not a valid solution for me, as I want to see the paginator even when there's only a single record in the table.

Question 1: Am I doing something wrong, that the "undefined" output appears in the paginator? How can I fix this?

Question 2: Can I dynamically hide the paginator when there are no records in the table?

Thanks
Primefaces 6.0
Mojarra 2.2.10
Wildfly 10.1

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

30 Nov 2015, 15:56

The data list must also be of 0 size or null.
The paginator will always disappear when there is no data to display and is replaced by the emptyMessage.
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

mauritzl
Posts: 14
Joined: 15 May 2013, 16:14
Location: Norway

05 Dec 2016, 16:21

I am also trying to get the paginator to dynamically respect the paginatorAlwaysVisible="false" setting depending on changes input by user in filter value input components.


Example:

1. Render a table with 200 rows, having paginator hide automatically if number of visible rows goes below 20 (rows = 20) page size.
2. Enter a value in a filter input text box for one of the columns that reduces number of visible rows to below 20.
3. Notice that paginator is still visible, even though one would assume it should now be automatically hidden due to the paginatorAlwaysVisible="false" setting.
4. Refresh the page, the paginator is now gone.

5. Clear filter value from filter input box.
6. Notice that paginator is not visible, even though one would expect it to be due to the fact that number of visible rows now exceeds the rows value (200). Also, number of visible rows are only 20, even though table should really show all 200 rows if paginator is not visible. This is really confusing for end users that now assumes the table do not contain more than 20 rows!
7. Refresh the page, paginator reappears.

Note: the example above assumes that the filterValue attribute of the dataTable's columns is bound to a bean with session scope to survive the page refresh.

I am considering filing this as a bug in the PF issue tracker, did you (slang2310) file an issue for your (similar) problem?
---------------------------
PrimeFaces 6.0.6
JBoss EAP 7 (Mojarra 2.2.12) | OmniFaces 2.4

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests