Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
2430b503
Commit
2430b503
authored
Sep 19, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] terms table: cache for sort preferences too
parent
311d73ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
NGrams_dyna_chart_and_table.js
static/lib/gargantext/NGrams_dyna_chart_and_table.js
+18
-12
No files found.
static/lib/gargantext/NGrams_dyna_chart_and_table.js
View file @
2430b503
...
@@ -198,6 +198,11 @@ function saveParamsToCache() {
...
@@ -198,6 +198,11 @@ function saveParamsToCache() {
// var page_status = document.getElementsByClassName("dynatable-page-link dynatable-active-page")[0].getAttribute("data-dynatable-page")
// var page_status = document.getElementsByClassName("dynatable-page-link dynatable-active-page")[0].getAttribute("data-dynatable-page")
var
per_page_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
perPage
var
per_page_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
perPage
// ex: {'name':1} or {'score':-1}
var
sorting_obj
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
sorts
var
sort_type_status
=
Object
.
keys
(
sorting_obj
).
pop
()
var
sort_direction_status
=
sorting_obj
[
sort_type_status
]
// keys and values are str only so we use path-like keys
// keys and values are str only so we use path-like keys
if
(
search_filter_status
)
{
if
(
search_filter_status
)
{
localStorage
[
corpusId
+
'/terms/search'
]
=
search_filter_status
localStorage
[
corpusId
+
'/terms/search'
]
=
search_filter_status
...
@@ -207,9 +212,11 @@ function saveParamsToCache() {
...
@@ -207,9 +212,11 @@ function saveParamsToCache() {
}
}
if
(
state_filter_status
)
{
if
(
state_filter_status
)
{
// console.warn("state_filter_status is set")
localStorage
[
corpusId
+
'/terms/state'
]
=
state_filter_status
localStorage
[
corpusId
+
'/terms/state'
]
=
state_filter_status
}
}
else
{
else
{
// console.warn("state_filter_status is NOT set")
localStorage
.
removeItem
(
corpusId
+
'/terms/state'
)
localStorage
.
removeItem
(
corpusId
+
'/terms/state'
)
}
}
if
(
type_filter_status
)
{
if
(
type_filter_status
)
{
...
@@ -219,19 +226,11 @@ function saveParamsToCache() {
...
@@ -219,19 +226,11 @@ function saveParamsToCache() {
localStorage
.
removeItem
(
corpusId
+
'/terms/type'
)
localStorage
.
removeItem
(
corpusId
+
'/terms/type'
)
}
}
// if (page_status) {
localStorage
[
corpusId
+
'/terms/perPage'
]
=
per_page_status
// localStorage[corpusId+'/terms/page'] = page_status
// localStorage[corpusId+'/terms/page'] = page_status
// }
// else {
// localStorage.removeItem(corpusId+'/terms/page')
// }
if
(
per_page_status
)
{
localStorage
[
corpusId
+
'/terms/sortType'
]
=
sort_type_status
localStorage
[
corpusId
+
'/terms/perPage'
]
=
per_page_status
localStorage
[
corpusId
+
'/terms/sortDirection'
]
=
sort_direction_status
}
else
{
localStorage
.
removeItem
(
corpusId
+
'/terms/perPage'
)
}
return
null
;
return
null
;
}
}
...
@@ -244,6 +243,8 @@ function restoreSettingsFromCache() {
...
@@ -244,6 +243,8 @@ function restoreSettingsFromCache() {
var
had_state
=
localStorage
[
corpusId
+
'/terms/state'
]
var
had_state
=
localStorage
[
corpusId
+
'/terms/state'
]
var
had_search
=
localStorage
[
corpusId
+
'/terms/search'
]
var
had_search
=
localStorage
[
corpusId
+
'/terms/search'
]
var
had_perPage
=
localStorage
[
corpusId
+
'/terms/perPage'
]
var
had_perPage
=
localStorage
[
corpusId
+
'/terms/perPage'
]
var
had_sortType
=
localStorage
[
corpusId
+
'/terms/sortType'
]
var
sortDirection
=
localStorage
[
corpusId
+
'/terms/sortDirection'
]
// if (had_page) {
// if (had_page) {
// MyTable.data('dynatable').paginationPage.set(had_page);
// MyTable.data('dynatable').paginationPage.set(had_page);
// }
// }
...
@@ -259,6 +260,11 @@ function restoreSettingsFromCache() {
...
@@ -259,6 +260,11 @@ function restoreSettingsFromCache() {
if
(
had_perPage
)
{
if
(
had_perPage
)
{
MyTable
.
data
(
'dynatable'
).
paginationPerPage
.
set
(
had_perPage
)
MyTable
.
data
(
'dynatable'
).
paginationPerPage
.
set
(
had_perPage
)
}
}
if
(
had_sortType
)
{
MyTable
.
data
(
'dynatable'
).
sorts
.
clear
();
MyTable
.
data
(
'dynatable'
).
sorts
.
add
(
had_sortType
,
sortDirection
)
console
.
log
(
"added sort"
,
had_sortType
)
}
// re-process to makes the changes visible
// re-process to makes the changes visible
MyTable
.
data
(
'dynatable'
).
process
()
MyTable
.
data
(
'dynatable'
).
process
()
...
...
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