diff --git a/demo/assets/menu.js b/demo/assets/menu.js index 32232a4..c194d51 100644 --- a/demo/assets/menu.js +++ b/demo/assets/menu.js @@ -14,7 +14,8 @@ { text: 'Custom theme', href: 'custom-theme.html' }, { text: 'Vuex Integration', href: 'vuex.html' }, { text: 'Exporting', href: 'exporting.html' }, - { text: 'Drag & Drop', href: 'dnd.html' } + { text: 'Drag & Drop', href: 'dnd.html' }, + { text: 'Updating', href: 'updating.html' }, ] function initMenu() { diff --git a/demo/pages/updating.html b/demo/pages/updating.html index 4163123..9e8af20 100644 --- a/demo/pages/updating.html +++ b/demo/pages/updating.html @@ -45,11 +45,11 @@ ] }), mounted() { - this.$nextTick(() => { - this.$refs.tree.update('Item 1', node => { - return { text: 'New Item!' }; + setTimeout(() => { + this.$refs.tree.updateData('Item 1', node => { + return { text: 'New Item!' } }); - }) + }, 1000) } }) diff --git a/package.json b/package.json index 2e74131..e890c57 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "liquor-tree", "description": "A Vue.js tree component.", - "version": "0.2.69", + "version": "0.2.70", "author": "Kostiantyn ", "library": "LiquorTree", "homepage": "https://amsik.github.io/liquor-tree/", diff --git a/src/lib/Node.js b/src/lib/Node.js index 298595e..8f1847d 100644 --- a/src/lib/Node.js +++ b/src/lib/Node.js @@ -82,11 +82,11 @@ export default class Node { } setData (data) { - this.data = Object.assign({}, this.data, data); + this.data = Object.assign({}, this.data, data) - this.$emit('data:changed', this.data); + this.$emit('data:changed', this.data) - return this.data; + return this.data } state (name, value) { diff --git a/src/lib/Tree.js b/src/lib/Tree.js index 1c5ea11..f8d0452 100644 --- a/src/lib/Tree.js +++ b/src/lib/Tree.js @@ -695,11 +695,11 @@ export default class Tree { } updateData (criteria, callback) { - const nodes = this.find(criteria); + const nodes = this.find(criteria) - nodes.forEach(node => node.setData(callback(node))); + nodes.forEach(node => node.setData(callback(node))) - return nodes; + return nodes } getNodeById (id) { diff --git a/src/mixins/TreeMixin.js b/src/mixins/TreeMixin.js index 2bf1a7b..6f9c94c 100644 --- a/src/mixins/TreeMixin.js +++ b/src/mixins/TreeMixin.js @@ -182,16 +182,12 @@ export default { return this.tree.find(criteria, true) }, - update (criteria, callback) { - return this.tree.update(criteria, callback); - }, - expandAll () { return this.tree.expandAll() }, updateData (criteria, callback) { - return this.tree.updateData(criteria, callback); + return this.tree.updateData(criteria, callback) }, collapseAll () {