Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Datatables filtering doesn't work on Server side.


Need some help, I use your PHP for Datatables and modify some of it to fit with my code. The filtering work if it's not using the server side. but when it does it doesn't work. Is it anything I can do to make this work? Thanks.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi,

To perform full server-side data processing you will need to perform the soring in your server-side as shown in this official example. You may fully refer to the official example and adopt it for your needs.

The JS code you referred is for frontend filtering. You should not use if you need a full backend data processing.

Regard.



Here's the filter code that I mean just in case needed:


const filterTraining = document.querySelector("[data-kt-filter="training_type"]");
const filterClassOf = document.querySelector("[data-kt-filter="class_of"]");

$(filterTraining).on("change", e => {
let value = e.target.value;
if(value === "all"){
value = "";
}
dt.column(3).search(value).draw();
});

$(filterClassOf).on("change", e => {
let value = e.target.value;
if(value === "all"){
value = "";
}
dt.column(6).search(value).draw();
});


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(