Skip to content

Commit

Permalink
fix(table): only call provider once DOM is fully updated (#1904) (#1955)
Browse files Browse the repository at this point in the history
* fix(table): only call provider once DOM is fully updated (#1904)

* fixing lint error.
  • Loading branch information
henryklukasik authored and mosinve committed Jul 23, 2018
1 parent 9ab23ef commit ae7147e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/components/table/table.js
Expand Up @@ -995,17 +995,20 @@ export default {
}
// Set internal busy state
this.localBusy = true
// Call provider function with context and optional callback
const data = this.items(this.context, this._providerSetLocal)
if (data && data.then && typeof data.then === 'function') {
// Provider returned Promise
data.then(items => {
this._providerSetLocal(items)
})
} else {
// Provider returned Array data
this._providerSetLocal(data)
}

// Call provider function with context and optional callback after DOM is fully updated
this.$nextTick(function () {
const data = this.items(this.context, this._providerSetLocal)
if (data && data.then && typeof data.then === 'function') {
// Provider returned Promise
data.then(items => {
this._providerSetLocal(items)
})
} else {
// Provider returned Array data
this._providerSetLocal(data)
}
})
},
getTdValues (item, key, tdValue, defValue) {
const parent = this.$parent
Expand Down

0 comments on commit ae7147e

Please sign in to comment.