The data passed to my server-side script
The data passed to my server-side script
My first attempt at using datatables I was a little unsure what was passed to my server-side script, but thought it would be
sEcho, iDisplayLength, iDisplayStart and sSearch as a minimum.
I wrote out the actual values as these;
draw = 1
search[regex] = false
columns[0][data] = 0
columns[0][name] =
columns[0][searchable] = true
columns[0][orderable] = true
columns[0][search][value] =
columns[0][search][regex] = false
columns[1][data] = 1
columns[1][name] =
columns[1][searchable] = true
columns[1][orderable] = true
columns[1][search][value] =
columns[1][search][regex] = false
columns[2][data] = 2
columns[2][name] =
columns[2][searchable] = true
columns[2][orderable] = true
columns[2][search][value] =
columns[2][search][regex] = false
columns[3][data] = 3
columns[3][name] =
columns[3][searchable] = true
columns[3][orderable] = true
columns[3][search][value] =
columns[3][search][regex] = false
columns[4][data] = 4
columns[4][name] =
columns[4][searchable] = true
columns[4][orderable] = true
columns[4][search][value] =
columns[4][search][regex] = false
columns[5][data] = 5
columns[5][name] =
columns[5][searchable] = true
columns[5][orderable] = true
columns[5][search][value] =
columns[5][search][regex] = false
columns[6][data] = 6
columns[6][name] =
columns[6][searchable] = true
columns[6][orderable] = true
columns[6][search][value] =
columns[6][search][regex] = false
columns[7][data] = 7
columns[7][name] =
columns[7][searchable] = true
columns[7][orderable] = true
columns[7][search][value] =
columns[7][search][regex] = false
columns[8][data] = 8
columns[8][name] =
columns[8][searchable] = true
columns[8][orderable] = true
columns[8][search][value] =
columns[8][search][regex] = false
order[0][column] = 0
order[0][dir] = asc
start = 0
length = 10
search[value] =
I don't really understand any of the column[] values however I didn't expect start and length etc. The code I'm using is very simple
$('#hourstable').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "fetchtable.asp",
"type": "POST"
}
} );
Why do I not get the standard variables passed?
Regards and thanks
Pete
This question has an accepted answers - jump to answer
Answers
You are getting the standard variables passed in. That's the 1.10 style of parameters. See the manual for a description of them.
See also the note on legacy parameters if you want to use the legacy interface.
Allan
Not sure I understand why as I'm using
cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js
Which seems to say 1.10 which I thought was the latest version.
DO I need to set something to use the later version of the parameters?
Pete
1.10.4 is the latest version and it is sending the parameters described in the manual as the parameters for 1.10 (such as
draw
etc).sEcho
is the legacy style - see the documentation page I linked to before.Allan