From c4991a5100e67c5a14d8b39494754fe304add020 Mon Sep 17 00:00:00 2001
From: uhensler <urs.hensler@frentix.com>
Date: Thu, 2 Jul 2020 14:57:26 +0200
Subject: [PATCH] OO-4630: Sort table date after a filter was applied

---
 .../flexible/impl/elements/table/FlexiTableElementImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
index 79d98399c89..58712fadbd1 100644
--- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
+++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableElementImpl.java
@@ -752,6 +752,7 @@ public class FlexiTableElementImpl extends FormItemImpl implements FlexiTableEle
 		return conditionalQueries;
 	}
 	
+	@Override
 	public SortKey[] getOrderBy() {
 		return orderBy;
 	}
@@ -1239,6 +1240,11 @@ public class FlexiTableElementImpl extends FormItemImpl implements FlexiTableEle
 			currentPage = 0;
 			doUnSelectAll();
 			((FilterableFlexiTableModel)dataModel).filter(getQuickSearchString(), selectedFilters);
+			if(dataModel instanceof SortableFlexiTableDataModel) {
+				if(orderBy != null && orderBy.length > 0) {
+					((SortableFlexiTableDataModel<?>)dataModel).sort(orderBy[0]);
+				}
+			}
 		} else if(dataSource != null) {
 			rowCount = -1;
 			currentPage = 0;
-- 
GitLab