Save sort order to local storage
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-04-01 22:01:19 +02:00
parent ed8e70abc8
commit f2e4b4543f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 1 deletions

View File

@ -193,7 +193,15 @@
}
},
created() {
this.$set(this, 'activeColumns', JSON.parse(localStorage.getItem('tableViewColumns')))
const savedShowColumns = localStorage.getItem('tableViewColumns')
if (savedShowColumns !== null) {
this.$set(this, 'activeColumns', JSON.parse(savedShowColumns))
}
const savedSortBy = localStorage.getItem('tableViewSortBy')
if (savedSortBy !== null) {
this.$set(this, 'sortBy', JSON.parse(savedSortBy))
}
this.initTasks(1)
},
methods: {
@ -215,6 +223,8 @@
this.$delete(this.sortBy, property)
}
this.initTasks(this.currentPage, this.searchTerm)
// Save the order to be able to retrieve them later
localStorage.setItem('tableViewSortBy', JSON.stringify(this.sortBy))
},
saveTaskColumns() {
localStorage.setItem('tableViewColumns', JSON.stringify(this.activeColumns))