Skip to content

Commit

Permalink
Merge pull request #45 from wyuenho/revert-28-master
Browse files Browse the repository at this point in the history
Revert "fix for #26"
  • Loading branch information
wyuenho committed Mar 14, 2016
2 parents 5d50a62 + d5f2c57 commit 0177d1e
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions backgrid-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@
*/
placeholder: null,

/**
@property [wait=false] The time in milliseconds to wait since the last
change to the search box's value before searching. This value can be
adjusted depending on how often the search box is used and how large the
search index is. For ServerSideFilter this is turned off by default.
*/
wait: false,

/**
@param {Object} options
@param {Backbone.Collection} options.collection
Expand All @@ -92,12 +84,6 @@
this.value = options.value || this.value;
this.placeholder = options.placeholder || this.placeholder;
this.template = options.template || this.template;
this.wait = options.wait || this.wait;

if (this.wait !== false) {
this.events["keydown input[type=search]"] = "search";
this._debounceMethods(["search", "clear"]);
}

// Persist the query on pagination
var collection = this.collection, self = this;
Expand All @@ -109,20 +95,7 @@
};
}
},

_debounceMethods: function(methodNames) {
if (_.isString(methodNames)) methodNames = [methodNames];

this.undelegateEvents();

for (var i = 0, l = methodNames.length; i < l; i++) {
var methodName = methodNames[i];
var method = this[methodName];
this[methodName] = _.debounce(method, this.wait);
}

this.delegateEvents();
},
/**
Event handler. Clear the search box and reset the internal search value.
*/
Expand Down Expand Up @@ -303,6 +276,20 @@
});
},

_debounceMethods: function (methodNames) {
if (_.isString(methodNames)) methodNames = [methodNames];

this.undelegateEvents();

for (var i = 0, l = methodNames.length; i < l; i++) {
var methodName = methodNames[i];
var method = this[methodName];
this[methodName] = _.debounce(method, this.wait);
}

this.delegateEvents();
},

/**
Constructs a Javascript regular expression object for #makeMatcher.
Expand Down

0 comments on commit 0177d1e

Please sign in to comment.