Get sent parameters without server-side processing

Get sent parameters without server-side processing

LukasLLukasL Posts: 26Questions: 10Answers: 0

"When making a request to the server using server-side processing, DataTables will send the following data in order to let the server know what data is required:" https://datatables.net/manual/server-side

Is there a way to get a JSON object of that data while Datatables is in client-side mode?

I imagine it would be something along the lines of table.ajax.params() where I could call a function and have it return me a JSON object of the table's current sort, search, etc. configurations.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    Answer ✓

    There are various API's that can be used such as:

    Here is a list of them.
    https://datatables.net/reference/api/

    Kevin

  • LukasLLukasL Posts: 26Questions: 10Answers: 0
    edited April 2020

    I am trying to get an array of column names as well and I found column().name() method. From what I understand, this method will only be available in DataTables 2.0.0?

    EDIT: I have found how to get an array of columns
    var columnNamesArr = table.columns().header().toArray().map(x => x.innerText);

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Is there a way to get a JSON object of that data while Datatables is in client-side mode?

    As you said, you can use ajax.params() to get what was set to the server, or ajax.json() to get what was returned. See example here - it shows both in the console when you click the button.

    Colin

This discussion has been closed.