Save sort order to local storage
All checks were successful
continuous-integration/drone/pr Build is passing

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

View File

@ -193,7 +193,15 @@
} }
}, },
created() { 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) this.initTasks(1)
}, },
methods: { methods: {
@ -215,6 +223,8 @@
this.$delete(this.sortBy, property) this.$delete(this.sortBy, property)
} }
this.initTasks(this.currentPage, this.searchTerm) this.initTasks(this.currentPage, this.searchTerm)
// Save the order to be able to retrieve them later
localStorage.setItem('tableViewSortBy', JSON.stringify(this.sortBy))
}, },
saveTaskColumns() { saveTaskColumns() {
localStorage.setItem('tableViewColumns', JSON.stringify(this.activeColumns)) localStorage.setItem('tableViewColumns', JSON.stringify(this.activeColumns))