Update mdbDatatable2 table using API


Topic: Update mdbDatatable2 table using API

FelixBraig asked 2 years ago

Hi,

I need to implement a table which shows data from an API. I did adapt the API to the respective predefined format given in the documentation. However, the sample code from the documentation does not work.

Expected behavior

The data provided by the API should show up in the table. My API provides json data in the appropriate format. It works when I give the data directly, i.e. data: "data" instead of v-model, but then the table won't update when necessary. When using the sample code provided below, the compiler throws an error:

error in ./src/components/AllLoggedEvents.vue?vue&type=template&id=fa4cad08&

Syntax Error: SyntaxError: Assigning to rvalue (1:176)

Actual behavior

The table stays blank.

Code taken from given example:

<template>
<mdb-datatable-2
    v-model="'https://YOUR_API'"
    striped
    bordered
    :display="3"
/>
</template>
<script>
    import { mdbDatatable2 } from 'mdbvue';
    export default {
        name: 'DatatablePage',
        components: {
        mdbDatatable2
         }
     }
</script>

I would really appreciate any help! Thank you!


Mikołaj Smoleński staff commented 2 years ago

In this case, I would ask you to recreate the issue in our Snippets Editor.

Best regards


FelixBraig commented 2 years ago

https://mdbootstrap.com/snippets/vue/felixbraig/2348508


Mikołaj Smoleński staff commented 2 years ago

I guess there is a problem with JSON data structure. I'm adding this problem to our list of issues. Best regards


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: Laptop
  • Browser: Firefox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No