Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Datatables Ajax Serverside pagination not working


Hi, i refer to this documentation,
https://preview.keenthemes.com/html/keen/docs/general/datatables/server-side

i put the javascript to my code and its working perfectly if i use endpoint url u provide, this: url: "https://preview.keenthemes.com/api/datatables.php",

if i use my own data with my url endpoint, all data show in 1 page, all function like search, filter, pagination not working.


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


Hi Aizuddin,

In this case, it's essential to ensure that your backend API is set up to handle search, filtering, and pagination.

Here are some steps to consider:

Make sure your backend API (the one you're using in your code) is configured to support server-side processing for DataTables. This means it should handle pagination, searching, and filtering requests. You can refer to the DataTables documentation for details on the expected request parameters.
https://datatables.net/examples/data_sources/server_side

Ensure that your DataTables initialization script sends the correct parameters to your backend API. This includes parameters like draw, start, length, search[value], and any additional parameters your API expects for filtering.

Your API should respond with data that matches the format expected by DataTables. The response should include the total number of records, the filtered records, and the data to be displayed on the current page.

If you've configured your backend API to handle server-side processing correctly and are still facing issues, it might be helpful to provide more details about your backend code and how you're making the requests. That way, we can offer more specific guidance.



is class-list-util.php necessary? i run in local, its working but not when i run in server. if u have sample code, please share with me,tq



The `class-list-util.php` file is not necessary, depending on your project's requirements. It contain helper functions for listing arrays for our demo purpose.

You may get it here:
https://gist.github.com/KeenthemesHub/bbb14a707b75d3d20e3eea4c014b3414


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