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/12/11 07:54:30 UTC

[myfaces-tobago] 15/22: 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-1999_Select2
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit d938985c72bb47916065a9a45acd3d0f87140508
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));
   }