Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
9538a92f
Commit
9538a92f
authored
Apr 04, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] fix table pagination
parent
e13b7804
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+8
-3
Table.purs
src/Gargantext/Components/Table.purs
+14
-3
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
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
...
...
src/Gargantext/Components/Table.purs
View file @
9538a92f
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 =
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment