I am using server side processing with angular datatable. Is there anyway to turn off auto filtering in the search box and make it to search/filter (ajax call to server side) only when search button is click. Hope someone experience in angular datatable can help.
You can do this in 4 steps :
dtInstance
)dtInstance
when the new search button is clickedUse the initComplete
callback to make the modifications, example :
$scope.dtOptions = DTOptionsBuilder.newOptions()
//other options
.withOption('initComplete', function() {
$('.dataTables_filter input').unbind();
$('<button/>').text('search').attr('id', 'new-search').appendTo('.dataTables_filter');
$('#new-search').on('click', function() {
$scope.dtInstance.DataTable.search($('.dataTables_filter input').val()).draw();
})
})
Include the directive instance
$scope.dtInstance = {};
<table datatable dt-options="dtOptions" dt-columns="dtColumns" dt-instance="dtInstance" >
demo -> http://plnkr.co/edit/afMNeuUbwolGPffTdson?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With