Fix controls not responding after pagesize change
This commit is contained in:
parent
1304fb146d
commit
f1f1cd9a36
@ -517,7 +517,7 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
|||||||
, fieldEnctype = UrlEncoded
|
, fieldEnctype = UrlEncoded
|
||||||
}
|
}
|
||||||
|
|
||||||
piPrevious <- lift . runInputMaybe $ ireq (jsonField True) (wIdent "pagination")
|
piPrevious <- lift . runInputPostMaybe $ ireq (jsonField True) (wIdent "pagination")
|
||||||
let piPreviousRes = maybe FormMissing FormSuccess piPrevious
|
let piPreviousRes = maybe FormMissing FormSuccess piPrevious
|
||||||
previousKeys <- throwExceptT . runMaybeT $ encodedSecretBoxOpen =<< MaybeT (lift . lookupPostParam $ wIdent "previous")
|
previousKeys <- throwExceptT . runMaybeT $ encodedSecretBoxOpen =<< MaybeT (lift . lookupPostParam $ wIdent "previous")
|
||||||
|
|
||||||
@ -601,6 +601,7 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
|||||||
, foldr (.) id . map (\k -> setParams (wIdent $ toPathPiece k) . fromMaybe [] . join $ traverse (Map.lookup k) piFilter) $ Map.keys dbtFilter
|
, foldr (.) id . map (\k -> setParams (wIdent $ toPathPiece k) . fromMaybe [] . join $ traverse (Map.lookup k) piFilter) $ Map.keys dbtFilter
|
||||||
, setParam (wIdent "pagesize") $ fmap toPathPiece piLimit
|
, setParam (wIdent "pagesize") $ fmap toPathPiece piLimit
|
||||||
, setParam (wIdent "page") $ fmap toPathPiece piPage
|
, setParam (wIdent "page") $ fmap toPathPiece piPage
|
||||||
|
, setParam (wIdent "pagination") Nothing
|
||||||
]
|
]
|
||||||
|
|
||||||
if
|
if
|
||||||
@ -615,13 +616,11 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
|||||||
| (E.Value n, _, _):_ <- rows' = n
|
| (E.Value n, _, _):_ <- rows' = n
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
|
|
||||||
filterAction = tblLink
|
rawAction = tblLink
|
||||||
$ setParam (wIdent "page") Nothing
|
$ setParam (wIdent "sorting") Nothing
|
||||||
. Map.foldrWithKey (\k _ f -> setParam (wIdent $ toPathPiece k) Nothing . f) id dbtFilter
|
|
||||||
|
|
||||||
pagesizeAction = tblLink
|
|
||||||
$ setParam (wIdent "page") Nothing
|
|
||||||
. setParam (wIdent "pagesize") Nothing
|
. setParam (wIdent "pagesize") Nothing
|
||||||
|
. setParam (wIdent "page") Nothing
|
||||||
|
. setParam (wIdent "pagination") Nothing
|
||||||
|
|
||||||
table' :: WriterT x m Widget
|
table' :: WriterT x m Widget
|
||||||
table' = do
|
table' = do
|
||||||
@ -656,7 +655,7 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
|||||||
|
|
||||||
return $(widgetFile "table/layout")
|
return $(widgetFile "table/layout")
|
||||||
|
|
||||||
bool (dbHandler (Proxy @m) (Proxy @x) $ (\table -> $(widgetFile "table/layout-wrapper")) . dbsLayoutFilter filterWdgt filterEnc filterAction) (sendResponse <=< tblLayout . dbsLayoutFilter filterWdgt filterEnc filterAction <=< dbWidget (Proxy @m) (Proxy @x)) psShortcircuit <=< runDBTable dbtable paginationInput currentKeys . fmap swap $ runWriterT table'
|
bool (dbHandler (Proxy @m) (Proxy @x) $ (\table -> $(widgetFile "table/layout-wrapper")) . dbsLayoutFilter filterWdgt filterEnc rawAction) (sendResponse <=< tblLayout . dbsLayoutFilter filterWdgt filterEnc rawAction <=< dbWidget (Proxy @m) (Proxy @x)) psShortcircuit <=< runDBTable dbtable paginationInput currentKeys . fmap swap $ runWriterT table'
|
||||||
where
|
where
|
||||||
tblLayout :: forall m'. (MonadHandler m', HandlerSite m' ~ UniWorX) => Widget -> m' Html
|
tblLayout :: forall m'. (MonadHandler m', HandlerSite m' ~ UniWorX) => Widget -> m' Html
|
||||||
tblLayout tbl' = do
|
tblLayout tbl' = do
|
||||||
|
|||||||
@ -6,7 +6,7 @@ $else
|
|||||||
^{table}
|
^{table}
|
||||||
$if pageCount > 1
|
$if pageCount > 1
|
||||||
<div .pagination>
|
<div .pagination>
|
||||||
<form .pagesize method=GET enctype=#{pagesizeEnc} action=#{pagesizeAction}>
|
<form .pagesize method=GET enctype=#{pagesizeEnc} action=#{rawAction}>
|
||||||
^{pagesizeWdgt}
|
^{pagesizeWdgt}
|
||||||
<ul ##{wIdent "pagination"} .pages>
|
<ul ##{wIdent "pagination"} .pages>
|
||||||
$forall p <- pageNumbers
|
$forall p <- pageNumbers
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user