Replace Search "keyup" with a Button
Replace Search "keyup" with a Button
martin@sommer.net
Posts: 15Questions: 0Answers: 0
Hi,
I am using server side processing, have tried the fnSetFilteringDelay filter delay, and would simply like to replace the keyup activation with a "Search" button. Too many times users are unexpectedly triggering queries, by doing nothing.
How can this be done?
Thanks,
Martin
I am using server side processing, have tried the fnSetFilteringDelay filter delay, and would simply like to replace the keyup activation with a "Search" button. Too many times users are unexpectedly triggering queries, by doing nothing.
How can this be done?
Thanks,
Martin
This discussion has been closed.
Replies
Regards,
Allan
/*
* Usage: $('#example').dataTable().fnFilterOnButton();
* Author: Jcodecowboy
* License: GPL v2 or BSD 3 point style
*/
var _that = this;
this.each(function (i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup');
var searchButton = $('#id_of_button').bind('click', function(e){
_that.fnFilter(anControl.val());
});
return this;
});
return this;
}
/* Example call
$(document).ready(function() {
$('.dataTable').dataTable().fnFilterOnButton();
} );
*/[/code]