Skip to content

Commit

Permalink
Model Treeview: Remember the expanded state
Browse files Browse the repository at this point in the history
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
  • Loading branch information
jimtng committed Feb 21, 2024
1 parent ff034d5 commit 1d2101e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
includeNonSemantic: false,
includeItemName: this.$f7.data.modelPicker.includeItemName || false,
includeItemTags: this.$f7.data.modelPicker.includeItemTags || false,
expanded: false,
expanded: this.$f7.data.modelPicker.expanded || false,
doubleClickStarted: null,
doubleClickItem: null,
items: [],
Expand Down Expand Up @@ -215,7 +215,10 @@ export default {
this.loading = false
this.ready = true
this.$nextTick(() => { this.initSearchbar = true })
this.$nextTick(() => {
this.initSearchbar = true
this.applyExpandedOption()
})
})
},
getChildren (parent) {
Expand Down Expand Up @@ -315,7 +318,10 @@ export default {
},
toggleExpanded () {
this.expanded = !this.expanded
this.$f7.data.modelPicker.expanded = this.expanded
this.applyExpandedOption()
},
applyExpandedOption () {
const treeviewItems = document.querySelectorAll('.treeview-item')
treeviewItems.forEach(item => {
Expand Down
12 changes: 9 additions & 3 deletions bundles/org.openhab.ui/web/src/pages/settings/model/model.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export default {
includeNonSemantic: false,
includeItemName: this.$f7.data.model.includeItemName || false,
includeItemTags: this.$f7.data.model.includeItemTags || false,
expanded: false,
expanded: this.$f7.data.model.expanded || false,
items: [],
links: [],
locations: [],
Expand Down Expand Up @@ -374,7 +374,10 @@ export default {
this.loading = false
this.ready = true
this.$nextTick(() => { this.initSearchbar = true })
this.$nextTick(() => {
this.initSearchbar = true
this.applyExpandedOption()
})
if (!this.eventSource) this.startEventSource()
})
},
Expand Down Expand Up @@ -491,7 +494,10 @@ export default {
},
toggleExpanded () {
this.expanded = !this.expanded
this.$f7.data.model.expanded = this.expanded
this.applyExpandedOption()
},
applyExpandedOption () {
const treeviewItems = document.querySelectorAll('.treeview-item')
treeviewItems.forEach(item => {
Expand Down

0 comments on commit 1d2101e

Please sign in to comment.