Server-side - Global Search - the search parameter received by the server-side is 'null'.
Server-side - Global Search - the search parameter received by the server-side is 'null'.

http://live.datatables.net/dexivuxu/1/edit
I am trying to convert an existing working DataTables to server-side. I have most of it working. However, I am stuck on filtering and ordering. First filtering. Each time I enter a value in "Search:" (the global search field) the server-side is called; however, the 'search' value received on the server-side is 'null'. On the server-side I use the following java code:
//DataTables Server-side variables
String draw = request.getParameter("draw"); //Counter to ensure correct order
int start = Integer.parseInt(request.getParameter("start"));//Number of rows to return
int length = Integer.parseInt(request.getParameter("length"));//Number of rows to return
String search = request.getParameter("search"); // Global search value
The variables 'draw', 'start' and 'length' are correct when I display them; however, 'search' contains null.
I obtained the parameter (search) to use from: https://datatables.net/manual/server-side
Kind regards,
Glyn
This question has an accepted answers - jump to answer
Answers
The parameter isn't just 'search'. There are two parameters; one is
search[value]
and the other issearch[regex]
.Kevin
Thanks Kevin. I am not using search[regex] at the moment; however, just in case, how is it set to 'true' (it is currently 'false') please?
Use
search.regex
. Or set the option using thesearch()
API.Kevin
Thank you. So:
$('#example').dataTable( {
"search": {
"regex": true
}
} );