Metronic Mega Update!Tailwind 4, React 19, Next.js 15, KtUI, ReUI, eCommerce, User Management Apps and more
Explore Update

KTdatatable


I have a question about using KTdatatable. I’m unable to refresh the data. I want to modify the content of the table in HTML and recreate the KTdatatable, but I cannot do so. The dispose function mentioned in the documentation does not work. There’s no destroy function either. How can I refresh the table on the screen?


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)


If you're having trouble refreshing your KTDatatable, especially after modifying the HTML content directly, it's important to note that KTDatatable does not provide a built-in destroy or fully functional dispose method to reset and reinitialize the table. Instead, a reliable workaround is to remove the original table DOM element entirely (e.g., using jQuery’s .remove()) and then recreate it from scratch with fresh data and reinitialize the KTDatatable plugin. This approach simulates a full refresh since KTDatatable instances are tightly bound to their initialization state. For example, just like updating a trending xxbrits (baddiehub fashion) feed requires clearing and reloading the UI, your table must also be rebuilt from the ground up to reflect updated content.



Hi Leo Cha,

Sorry for the delay. Could you please use reload() function?


var tableElement = document.querySelector("#datatable");
var datatable = KTDatatable.getInstance(tableElement);
datatable.reload()


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  :(