how to get DT api in ajax.data function with server side
how to get DT api in ajax.data function with server side
johndegey
Posts: 6Questions: 2Answers: 1
Hello,
With server side processing, before sending data in the ajax request, i use a a function to alter the data send.
I would like to send the original column's index... but i can't find a way to obtain the api related to the actual datatable
$('.datatable').DataTable({
serverSide: true,
ajax: {
type: 'POST',
url: window.location.pathname,
data: function(data) { // how to have DT.api() ??? }}});
I did not found it in the doc... any idea ?
Thx
John
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't think there is a way at the moment. An oversight I'll need to look at fixing!
I don't quite understand what you are looking to do though? The column's index is already sent is it not?
Allan
Hello Allan,
Yes, the actual index is sent, but i have a problem with yadcf.
(related to a previous question here : https://datatables.net/forums/discussion/25858/server-side-new-api-statesave-colreorder-and-column-s-order-in-the-xhr-request#latest )
I use ColReorder, and i would like to send the original index, having something like
columns[0]['intialIndex'] = 3
Thx
I see. At the moment you would need to use
order[].data
option that is submitted to the server to reserve the mapping at the server-side. That is what my own examples do. However, I agree it could be useful to access the API in the callback.Allan
Can you provide a link to your examples because i do not see how you set the initial index in the DT initialization process.
John
The initial index is just the HTML order. However, to a large extent in most of my examples it order is irrelevant since it looks up the data name for each column to see what SQL column it belongs to. Example.
Allan
ok, that's what i already use.
yadcf doesn't work like that right now, it only use the original index...
Thanks for your reply.