Custom search fields in datatables
Custom search fields in datatables
tuytoosh
Posts: 2Questions: 1Answers: 0
Hi all, I want to add some custom fields that they are not in table and stored in MySQL database, for example and in a simple word I have a ref_code filed in database that not shows in table... I want to add a 'Reference code' field... my problem is how to send custom search field value in every table draw()
my code is like below :
var table = $('#my-table').DataTable({
serverSide: true,
ajax:{
"url" : '{{ url('user/transaction/ajax') }}',
"data" : {
"type" : '{{ $type }}',
"id" : '{{ $id }}',
"ref_code" : $('#ref_code').val()
}
} ,
});
$('#ref_code').keyup( function() {
table.draw();
} );
This code sends empty variable as ref_code
in every ajax request...
This discussion has been closed.
Answers
I find my answer
I hope this helps someone else...