mdb-datatable-2 API rendering (lack of)


Topic: mdb-datatable-2 API rendering (lack of)

shineinterview asked 4 years ago

Expected behavior

Call an external secure API and load data into an mdb-datatable-2 - we cannot put thew API URL inside the HTML mdb-datatable-2 as we need to pass authentication tokens.

Actual behavior

As such we call the API on the created method.

But this will not render the datatable.

If we use a std, mdb-tbl and a v-for="user in users" scenario all is good.

However we've obtained the full features of mdb so want to use this method of loading data, then sorting and paging etc.

Resources (screenshots, code snippets etc.)

Please advise a solution:

  <mdb-datatable-2
:data="users"
striped
bordered

/>

created () { this.getUsers() },

getUsers () {
  userService.getAllUsers(this.authData.access_token).then((response) => {
    this.users = response.data
  })
},

Magdalena Dembna staff premium commented 4 years ago

Have tried following this example from our docs? https://mdbootstrap.com/docs/vue/tables/datatables/#external-api

Best regards, Magdalena


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 6.7.1
  • Device: PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No