Skip to content

Instantly share code, notes, and snippets.

@barakargaman
Last active December 30, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barakargaman/7847640 to your computer and use it in GitHub Desktop.
Save barakargaman/7847640 to your computer and use it in GitHub Desktop.
filter rows on mode checkbox change
var modes = ['free_submission_free_day',
'paid_submission_free_day',
'free_submission_bargain_day',
'paid_submission_bargain_day'
];
$('input[type="checkbox"]').on('change', function() {
var modes_code = _.map(modes, function(i){ ($('.'+i).val()) ? '1' : '.' }).join();
var rex = new RegExp(modes_code, 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function() {
return rex.test($(this).data('modes_code'));
}).show();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment