Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

KTDatatable component


Hi all!

I have been trying to get the KTDatatable component to work but no joy so far.
I did look through all the documentation I could find on the KTDatatables and the only real documentation I found (https://preview.keenthemes.com/metronic8/vue/docs/#/kt-datatables) does only have boilerplate html en JS code in it and these are the ones I'm using, the one with the loading to be specific.
The loading prop however is working perfectly fine.
I'm able to get the the component on my page en it works perfectly fine if I load static data.
Once I do a call my api and put the :table-data prop to users where users is an array. Containing an empty array at first but it gets updated once the data from the api is returned.
The :table-data gets updated in the component as it should but the const getitems never gets recomputed thus no rows are shown in the datatable.
Is there something I'm missing at my part or am I doing something wrong?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi Lukas!

Could you please attach the code of your getItems function?

You need to add a variable to your component which will be passed into a KTDatatable through table-data prop and when you receive data from your API you need to update this variable.

Update variable using splice function as shown in the example below.

variable_passed_to_table.value.splice(0, variable_passed_to_table.value.length, ...variable_passed_to_table.value);



Allright I got the data in the table with the code above!
Thanks!


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(