Put your custom filter in place using standard DOM / jQuery techniques and then use fnFilter ( http://datatables.net/api#fnFilter ) to apply the filter to DataTables.
Thanks for the response. I have read some articles about DOM but until now I still don't know how to implement it correctly. And for the fnFilter, currently I apply the fnServerData approach. Using this code
[code]
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "msisdn", "value": $('#msisdn').val() } );
aoData.push( { "name": "msgdata", "value": $('#msgdata').val() } );
$.ajax({
"dataType": 'json',
"type": "GET",
"url": "../log/ajax.php",
"data": aoData,
"success": fnCallback
});
},
[/code]
[code]
$('#msisdn').change(function() { oTable.fnDraw(); });
$('#msgdata').change(function() { oTable.fnDraw(); });
[/code]
Currently the query perform direclty when we type something in the field. Is it possible to add a button and only do the query after we hit the button? Thanks
Yes - you can do something like this plug-in which will filter only when the return key is pressed: http://datatables.net/plug-ins/api#fnFilterOnReturn . You can add a button to do something similar if you want.
Replies
Allan
[code]
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "msisdn", "value": $('#msisdn').val() } );
aoData.push( { "name": "msgdata", "value": $('#msgdata').val() } );
$.ajax({
"dataType": 'json',
"type": "GET",
"url": "../log/ajax.php",
"data": aoData,
"success": fnCallback
});
},
[/code]
[code]
$('#msisdn').change(function() { oTable.fnDraw(); });
$('#msgdata').change(function() { oTable.fnDraw(); });
[/code]
Currently the query perform direclty when we type something in the field. Is it possible to add a button and only do the query after we hit the button? Thanks
Allan