3.0.M2 lazyloading datatable filtering paginator refresh

UI Components for JSF
Post Reply
canseverayberk
Posts: 1
Joined: 11 Jul 2011, 09:20

11 Jul 2011, 09:26

After migrating from 2.2.1 to 3.0.M2, datatable filtering began not to refresh paginator. Full data is 35 pages and filtered data is 2 pages.
After filtering, even i set the new row count, the paginator still shows 35 pages.
Was not setRowCount() for this purpose?

What do i have to do extra ?

luisalves00
Posts: 71
Joined: 21 Feb 2011, 18:37

11 Jul 2011, 12:45

try this patch

Index: DataHelper.java
===================================================================
--- DataHelper.java (revision 4339)
+++ DataHelper.java (working copy)
@@ -124,7 +124,8 @@
}

table.setFilters(filters);
-
+ //loading data so table.getRowCount() is up to date
+ table.loadLazyData();
//Metadata for callback
if(table.isPaginator()) {
RequestContext.getCurrentInstance().addCallbackParam("totalRecords", table.getRowCount());
Index: DataTableRenderer.java
===================================================================
--- DataTableRenderer.java (revision 4339)
+++ DataTableRenderer.java (working copy)
@@ -451,15 +451,17 @@
Object selection = table.getSelection();

int rows = table.getRows();
- int first = table.getFirst();
+ int first = table.getFirst();
+
+ //if table is filtered, data has already been loaded in DataHelper.decodeFilterRequest()
+ if(table.isLazy() && !table.isFilterRequest(context)) {
+ table.loadLazyData();
+ }
+
int rowCount = table.getRowCount();
int rowCountToRender = rows == 0 ? rowCount : rows;
boolean hasData = rowCount > 0;

- if(table.isLazy()) {
- table.loadLazyData();
- }
-
String tbodyClass = hasData ? DataTable.DATA_CLASS : DataTable.EMPTY_DATA_CLASS;

writer.startElement("tbody", null);

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests