summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/DataTable.vue
diff options
context:
space:
mode:
authorUdo Walter2019-02-22 09:08:43 +0100
committerUdo Walter2019-02-22 09:08:43 +0100
commit9d7fb88a37777622655f66ab8f1cbc512fbd7a33 (patch)
tree86f708583cf11617a4a5532cc3ae4292d9b45900 /webapp/src/components/DataTable.vue
parent[webapp/datatable] small bug fix (diff)
downloadbas-9d7fb88a37777622655f66ab8f1cbc512fbd7a33.tar.gz
bas-9d7fb88a37777622655f66ab8f1cbc512fbd7a33.tar.xz
bas-9d7fb88a37777622655f66ab8f1cbc512fbd7a33.zip
[webapp/datatable] Fix something. I really have no idea how to describe this ¯\_(ツ)_/¯
Diffstat (limited to 'webapp/src/components/DataTable.vue')
-rw-r--r--webapp/src/components/DataTable.vue36
1 files changed, 18 insertions, 18 deletions
diff --git a/webapp/src/components/DataTable.vue b/webapp/src/components/DataTable.vue
index 82703c1..70a29bd 100644
--- a/webapp/src/components/DataTable.vue
+++ b/webapp/src/components/DataTable.vue
@@ -237,28 +237,13 @@ export default {
}
},
watch: {
- items () {
- this.selectState = 0
- this.$emit('input', [])
+ rows () {
+ this.processSelected(this.selected)
},
value: {
immediate: true,
handler (newValue) {
- if (this.selected !== newValue) {
- const tmp = {}
- newValue.forEach(x => { tmp[x.id] = true })
- this.selected = []
- this.rows.forEach(row => {
- if (tmp[row.data.id] === true) {
- row.selected = true
- this.selected.push(row.data)
- } else {
- row.selected = false
- }
- })
- if (this.filteredRows) this.calcSelectState()
- this.$emit('input', this.selected)
- }
+ this.processSelected(newValue)
}
},
sortedRows () {
@@ -394,6 +379,21 @@ export default {
setShiftState (event) {
this.shiftKey = event.shiftKey
},
+ processSelected (selected) {
+ const tmp = {}
+ selected.forEach(x => { tmp[x.id] = true })
+ this.selected = []
+ this.rows.forEach(row => {
+ if (tmp[row.data.id] === true) {
+ row.selected = true
+ this.selected.push(row.data)
+ } else {
+ row.selected = false
+ }
+ })
+ if (this.onlyShowSelected) this.filterRows()
+ if (this.filteredRows) this.calcSelectState()
+ },
filterRows () {
if (this.search.every(s => s.text.raw === '') && !this.onlyShowSelected) this.filteredRows = this.sortedRows
const onlySelected = this.onlyShowSelected