Commit ce66dc4b authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-ngrams-pagination-fix-2' of...

Merge branch 'dev-ngrams-pagination-fix-2' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev
parents 45afaf45 9538a92f
......@@ -323,12 +323,17 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render
, ngramsSelection, ngramsSelectAll }
_reactChildren =
[ autoUpdateElt { duration: 5000, effect: dispatch Synchronize }
, R2.scuff $ T.table { params: params /\ setParams -- TODO-LENS
, rows, container, colNames, wrapColElts, totalRecords
, R2.scuff $ T.table { colNames
, container
, params: params /\ setParams -- TODO-LENS
, rows: filteredRows
, totalRecords
, wrapColElts
}
]
where
totalRecords = 0 -- TODO, 0 to show first users that it is fake (until it is fixed)
totalRecords = A.length rows
filteredRows = T.filterRows { params } rows
colNames = T.ColumnName <$> ["Select", "Map", "Stop", "Terms", "Score"] -- see convOrderBy
selected =
input
......
module Gargantext.Components.Table where
import Prelude
import Data.Array (filter)
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
......@@ -156,6 +156,17 @@ tableCpt = R.hooksComponent "G.C.Table.table" cpt
, tableBody: map (H.tr {} <<< map (\c -> H.td {} [c]) <<< _.row) rows
}
type FilterRowsParams =
(
params :: Params
)
filterRows :: Record FilterRowsParams -> Rows -> Rows
filterRows { params: { limit, offset, orderBy } } rs = newRs
where
newRs = A.take limit $ A.drop offset $ rs
defaultContainer :: {title :: String} -> Record TableContainerProps -> R.Element
defaultContainer {title} props = R.fragment
[ R2.row
......@@ -238,8 +249,8 @@ pagination changePage tp cp =
H.text " ... "
else
H.text ""
lnums = map changePageLink' $ filter (1 < _) [cp - 2, cp - 1]
rnums = map changePageLink' $ filter (tp > _) [cp + 1, cp + 2]
lnums = map changePageLink' $ A.filter (1 < _) [cp - 2, cp - 1]
rnums = map changePageLink' $ A.filter (tp > _) [cp + 1, cp + 2]
changePageLink :: Int -> String -> R.Element
changePageLink i s =
......
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