Skip to content
Browse files

fixed revert bug!

  • Loading branch information...
1 parent a9cffc7 commit 90d7bc004067d0f58c859bf4fa6393d8a11737ac @torifat committed Apr 28, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 jquery.table.filter.js
View
15 jquery.table.filter.js
@@ -3,7 +3,8 @@
defaults = {
itemSelector: 'tr:has(td)',
column: 0,
- keyword: ''
+ keyword: '',
+ revert: false
};
function Plugin( element, options ) {
@@ -14,15 +15,17 @@
this._defaults = defaults;
this._name = pluginName;
- this.filter(this.options.keyword, this.options.column);
+ this.filter(this.options.keyword, this.options.column, this.options.revert);
}
- Plugin.prototype.filter = function (keyword, column) {
+ Plugin.prototype.filter = function (keyword, column, revert) {
+ if(typeof revert === 'undefined') {
+ revert = false;
+ }
var that = this;
$this.slideUp(function(){
$this.find(that.options.itemSelector).each(function(index, item){
- console.log(keyword);
- if(keyword && $(item).find('td:eq(' + column + ')').text() !== keyword) {
+ if(!revert && $(item).find('td:eq(' + column + ')').text() !== keyword) {
$(this).hide();
} else {
$(this).show();
@@ -37,7 +40,7 @@
if (!$.data(this, 'plugin_' + pluginName)) {
$.data(this, 'plugin_' + pluginName, new Plugin( this, options ));
} else {
- $.data(this, 'plugin_' + pluginName).filter(options.keyword, options.column);
+ $.data(this, 'plugin_' + pluginName).filter(options.keyword, options.column, options.revert);
}
});
};

0 comments on commit 90d7bc0

Please sign in to comment.
Something went wrong with that request. Please try again.