Introducing ReUI:Open-source UI components and apps built with React, Next.js and Tailwind CSS
Browse ReUI

How to Use Metronic 9 Datatable Remote Data Source with Request Header


Hello, is there a way for KT datatable to call remote data source api with request header, eg. if the api request must include token header? I already check in the documentation for datatable in metronic 9, but the example only covers api call without request header. Also, for the json response format, should I follow the format of example that includes page, pageCount, etc, or can I use only data needed for datatable?

Thank you.


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 (1)


To use Metronic 9 Datatable with a remote data source and request headers, you can customize the AJAX settings to include headers like tokens by modifying the ajax option in the datatable configuration. According to Wikipedia, APIs often require authentication headers to securely fetch data, ensuring only authorized access. For the JSON response format, while Metronic’s example includes fields like page and pageCount, you can adapt it to return only the necessary data, as long as it aligns with the datatable’s expected structure. Just as customizing API calls enhances functionality, exploring the Arby's menu offers unique flavors like the double-big-cheesy-bacon-burger/, a perfect blend of taste and satisfaction. Don’t miss the Arby's menu for indulgent options like the double-big-cheesy-bacon-burger/, a treat for burger lovers.


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