Datatables - Show full table if search box is empty
Datatables - Show full table if search box is empty
chankeypathak
Posts: 3Questions: 0Answers: 0
I wanted that datatable's search should search in table only when user presses the Enter after giving some input, so I wrote the below code. Now the problem is that after searching something if user cleans the input box then also he has to press enter (with no input data) to get back to the original state (to see complete table). So I want that if input field has no item then complete table should be visible. How can this be done?
[code]
jQuery.fn.dataTableExt.oApi.fnFilterOnEnter = function ( oSettings ) {
var _that = this;
this.each(function(i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var sPreviousSearch = null;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup').bind('keyup',function() {
/* Update the filter input elements for the new display */
for ( var i=0, iLen=anControl.length ; i
[code]
jQuery.fn.dataTableExt.oApi.fnFilterOnEnter = function ( oSettings ) {
var _that = this;
this.each(function(i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var sPreviousSearch = null;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup').bind('keyup',function() {
/* Update the filter input elements for the new display */
for ( var i=0, iLen=anControl.length ; i
This discussion has been closed.
Replies