Skip to content

Commit

Permalink
add new method support
Browse files Browse the repository at this point in the history
  • Loading branch information
kinglisky committed Jun 28, 2018
1 parent 00e0729 commit ff94e24
Showing 1 changed file with 20 additions and 35 deletions.
55 changes: 20 additions & 35 deletions src/methods.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
export default {
methods: {
trigger (method, ...args) {
const { $refs: { grid } } = this
if (grid && grid[method]) {
grid[method](...args)
}
},

toggleRowSelection (...args) {
this.trigger('toggleRowSelection', ...args)
},

toggleRowExpansion (...args) {
this.trigger('toggleRowExpansion', ...args)
},

setCurrentRow (...args) {
this.trigger('setCurrentRow', ...args)
},
const METHOD_NAMES = [
"setCurrentRow",
"toggleRowSelection",
"toggleRowExpansion",
"clearSelection",
"clearFilter",
"clearSort",
"doLayout",
"sort"
]

clearSort () {
this.trigger('clearSort')
},
const methods = {}

clearFilter () {
this.trigger('clearFilter')
},

clearSelection (...args) {
this.trigger('clearSelection', ...args)
},

doLayout () {
this.trigger('doLayout')
}
METHOD_NAMES.forEach(name => {
methods[name] = function (...args) {
const { grid } = this.$refs
if (grid && grid[name]) {
grid[name](...args)
}
}
}
})

export default { methods }

0 comments on commit ff94e24

Please sign in to comment.