You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2020/09/15 12:27:23 UTC

[myfaces-tobago] branch tobago-2.x updated: TOBAGO-703 - sheet paging should adjust scroll position

This is an automated email from the ASF dual-hosted git repository.

weber pushed a commit to branch tobago-2.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-2.x by this push:
     new 23e8d0a  TOBAGO-703 - sheet paging should adjust scroll position
23e8d0a is described below

commit 23e8d0a4b106a834538d2f6fdc0adcdfafd67024
Author: Volker Weber <v....@inexso.de>
AuthorDate: Tue Sep 15 14:27:16 2020 +0200

    TOBAGO-703 - sheet paging should adjust scroll position
---
 .../apache/myfaces/tobago/internal/component/AbstractUISheet.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
index 5c34b9c..10cbd40 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
@@ -540,6 +540,8 @@ public abstract class AbstractUISheet extends AbstractUIData
       LOG.debug("action = '" + pageEvent.getAction().name() + "'");
     }
 
+    Integer[] scrollPosition = getScrollPosition();
+    scrollPosition[1] = 0;
     switch (pageEvent.getAction()) {
       case FIRST:
         first = 0;
@@ -547,6 +549,7 @@ public abstract class AbstractUISheet extends AbstractUIData
       case PREV:
         first = getFirst() - getRows();
         first = first < 0 ? 0 : first;
+        scrollPosition[1] = Integer.MAX_VALUE;
         break;
       case NEXT:
         if (hasRowCount()) {
@@ -592,7 +595,10 @@ public abstract class AbstractUISheet extends AbstractUIData
       setFirst(first);
     }
 
-    getState().setFirst(first);
+    SheetState sheetState = getState();
+    sheetState.setFirst(first);
+    getAttributes().put(Attributes.SCROLL_POSITION, scrollPosition);
+    sheetState.setScrollPosition(scrollPosition);
 //      sheet.queueEvent(new SheetStateChangeEvent(sheet));
   }