Exact filtering not returning results

Exact filtering not returning results

d0mokund0mokun Posts: 12Questions: 4Answers: 0

Hello everyone,

I'm using the following to try and filter a column by an exact result (data). However, it returns no matches.

$('#orders').DataTable().column( 8 ).search("^" + data + "$", true, false, true).draw() ;

Using this code with the same input returns matches, though not exact.

$('#orders').DataTable().column( 8 ).search( data ).draw() ;

Where am I going wrong?
Thanks,
Dan

Answers

  • d0mokund0mokun Posts: 12Questions: 4Answers: 0

    I think I've worked out that it's because I'm using server side.

    How can I go about implementing searching server side with regex?

    Thanks
    Dan.

  • carranthuohill3carranthuohill3 Posts: 4Questions: 1Answers: 1

    Hi

    You have to handle searching with regex in your application code.
    List of parameters are sent by server:
    https://datatables.net/manual/server-side

    You can use columns[i][search][value] and columns[i][search][regex] to get search parameter and check if you should use regex.

  • d0mokund0mokun Posts: 12Questions: 4Answers: 0

    Hi and thanks,

    Are there any available examples of using server side in that way? I don't understand how to change parameters sent.

    My current ajax code just sits at :

    .DataTable( { ...
       "ajax": "../assets/orders/orders_table_ajax.php", ....
    
This discussion has been closed.