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
6f0964ea
Commit
6f0964ea
authored
Apr 23, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] fixes to initial values for table
Related to #165.
parent
ef0a389d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Table.purs
src/Gargantext/Components/Table.purs
+13
-3
No files found.
src/Gargantext/Components/Table.purs
View file @
6f0964ea
...
@@ -64,6 +64,12 @@ type State =
...
@@ -64,6 +64,12 @@ type State =
, orderBy :: OrderBy
, orderBy :: OrderBy
}
}
paramsState :: Params -> State
paramsState {offset, limit, orderBy} = {pageSize, page, orderBy}
where
pageSize = int2PageSizes limit
page = offset / limit + 1
stateParams :: State -> Params
stateParams :: State -> Params
stateParams {pageSize, page, orderBy} = {offset, limit, orderBy}
stateParams {pageSize, page, orderBy} = {offset, limit, orderBy}
where
where
...
@@ -128,9 +134,10 @@ tableCpt :: R.Component Props
...
@@ -128,9 +134,10 @@ tableCpt :: R.Component Props
tableCpt = R.hooksComponent "G.C.Table.table" cpt
tableCpt = R.hooksComponent "G.C.Table.table" cpt
where
where
cpt {container, colNames, wrapColElts, totalRecords, rows, params} _ = do
cpt {container, colNames, wrapColElts, totalRecords, rows, params} _ = do
pageSize@(pageSize' /\ setPageSize) <- R.useState' PS10
let initialState = paramsState $ fst params
(page /\ setPage) <- R.useState' 1
pageSize@(pageSize' /\ setPageSize) <- R.useState' initialState.pageSize
(orderBy /\ setOrderBy) <- R.useState' Nothing
(page /\ setPage) <- R.useState' initialState.page
(orderBy /\ setOrderBy) <- R.useState' initialState.orderBy
let
let
state = {pageSize: pageSize', orderBy, page}
state = {pageSize: pageSize', orderBy, page}
ps = pageSizes2Int pageSize'
ps = pageSizes2Int pageSize'
...
@@ -277,6 +284,9 @@ instance showPageSize :: Show PageSizes where
...
@@ -277,6 +284,9 @@ instance showPageSize :: Show PageSizes where
show PS100 = "100"
show PS100 = "100"
show PS200 = "200"
show PS200 = "200"
int2PageSizes :: Int -> PageSizes
int2PageSizes i = string2PageSize $ show i
pageSizes2Int :: PageSizes -> Int
pageSizes2Int :: PageSizes -> Int
pageSizes2Int PS10 = 10
pageSizes2Int PS10 = 10
pageSizes2Int PS20 = 20
pageSizes2Int PS20 = 20
...
...
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