[Vuejs]-Load data from API into mdbootstrap datatable (vue.js, axios)

0👍

I managed to solve the problem by writing the method getTableData(). Important is to use push() on the array in order to have vue rendering the html newly.

},
async created () {
  this.refreshPosts()
  this.setup()
  await this.getTableData()
},

},
  getTableData () {
    return api.getPosts().then(response => {
      var index
      let temp = response
      console.log(temp)
      for (index = 0; index < temp.length; ++index) {
        this.data.rows.push({
          title: temp[index].title,
          immo_id: temp[index].immo_id,
          price: temp[index].price
        })
      }
    }
    )
  }

Leave a comment