From 39f5c5ece22bbd34538f0db63f1fe51d2a94b083 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 25 Apr 2019 13:12:36 +0200 Subject: [PATCH] Make new sorting stable wrt old settings Fixes #317 --- src/Handler/Utils/Table/Pagination.hs | 1 + templates/table/cell/header.hamlet | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Handler/Utils/Table/Pagination.hs b/src/Handler/Utils/Table/Pagination.hs index 81ca65bd4..ce39f6300 100644 --- a/src/Handler/Utils/Table/Pagination.hs +++ b/src/Handler/Utils/Table/Pagination.hs @@ -727,6 +727,7 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db isSortable = isJust sortableKey isSorted = (`elem` directions) attrs = sortableContent ^. cellAttrs + piSorting' = [ sSet | sSet <- fromMaybe [] piSorting, Just (sortKey sSet) /= sortableKey ] return $(widgetFile "table/cell/header") columnCount :: Int64 diff --git a/templates/table/cell/header.hamlet b/templates/table/cell/header.hamlet index 5322aef4d..408dc4561 100644 --- a/templates/table/cell/header.hamlet +++ b/templates/table/cell/header.hamlet @@ -2,10 +2,10 @@ $maybe flag <- sortableKey $case directions $of [SortAsc] - + ^{widget} $of _ - + ^{widget} $nothing ^{widget}