Topic: load an mdbtable from an API
Webbkameror.se free asked 4 years ago
I expect to be able to load data to the data.rows object in "Created" our "Mounted" from an API call so that I can display data in my mdbtable
In actuality, this seems to be quite impossible. All attempts (I have struggled with this for the past 8 hours)
I have seen other users with the same question on this website. They have received the answer (which is also available in the documentation) that they should add the URL to the API in the :data variable like this:
This will make both Vue and Webstorm crash and protest since the ":" (colon) is an invalid operator. I see no other way of loading data from my database in to this table. What is the solution??
Yes, if the communication in the support threads and the in the documentation changes to reflect the fact the attribute value should be in both double quotes and in single quotes:
"'https://YOUR_API_URL'", then I will be happy.
Hi, Thank you for letting us know about this mistake, we'll fix it as soon as possible. Does it solve your problem? Kind regards, Magdalena
Hi, Unfortunately, right now for the code above to work correctly, the JSON data needs to structured in a following way: https://my-json-server.typicode.com/Rotarepmi/exjson/db . For now, the only solution I can propose would be to load you data in the lifecycle hook method and then pass them to data() in the required format. We are currently working on the better solution and we're sorry for the inconvenience. Best regards, Magdalena
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 5.1.1
- Device: Any
- Browser: Any
- OS: Any
- Provided sample code: No
- Provided link: No