Commit 4eb82bba authored by Karen Konou's avatar Karen Konou

[Ngrams Table] terms page reset on params change

parent 918c086d
......@@ -41,6 +41,7 @@ import Gargantext.Components.NgramsTable.SelectionCheckbox as NTSC
import Gargantext.Components.NgramsTable.SyncResetButton (syncResetButtons)
import Gargantext.Components.NgramsTable.Tree (renderNgramsItem, renderNgramsTree)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table (changePage)
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (AffRESTError, RESTError, logRESTError)
......@@ -154,6 +155,7 @@ tableContainerCpt { addCallback
, termListFilter
, termSizeFilter
} <- T.useLive T.unequal path
params <- T.useFocused (_.params) (\a b -> b { params = a }) path
-- | Computed
-- |
......@@ -217,7 +219,7 @@ tableContainerCpt { addCallback
{ id: "picklistmenu"
, className: "form-control custom-select"
, defaultValue: (maybe "" show termListFilter)
, on: {change: setTermListFilter <<< read <<< R.unsafeEventValue}
, on: {change: changeTermList params}
}
(map optps1 termLists)
]
......@@ -233,7 +235,7 @@ tableContainerCpt { addCallback
{ id: "picktermtype"
, className: "form-control custom-select"
, defaultValue: (maybe "" show termSizeFilter)
, on: {change: setTermSizeFilter <<< read <<< R.unsafeEventValue}
, on: {change: changeTermSize params}
}
(map optps1 termSizes)
]
......@@ -354,6 +356,14 @@ tableContainerCpt { addCallback
setTermSizeFilter x = T.modify (_ { termSizeFilter = x }) path
setSelection term = dispatch $ setTermListSetA ngramsTableCache ngramsSelection term
changeTermList params e = do
_ <- setTermListFilter $ read $ R.unsafeEventValue e
changePage 1 params
changeTermSize params e = do
_ <- setTermSizeFilter $ read $ R.unsafeEventValue e
changePage 1 params
selectionsExist :: Set NgramsTerm -> Boolean
selectionsExist = not <<< Set.isEmpty
......
......@@ -426,7 +426,8 @@ sizeDDCpt = here.component "sizeDD" cpt
className = "form-control"
change e = do
let ps = string2PageSize $ R.unsafeEventValue e
T.modify (\p -> stateParams $ (paramsState p) { pageSize = ps }) params
_ <- T.modify (\p -> stateParams $ (paramsState p) { pageSize = ps }) params
changePage 1 params
sizes = map option pageSizes
option size = H.option {value} [H.text value]
where value = show size
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment