Permalink
Browse files

Basic filtering functionality with single item selector parameter

  • Loading branch information...
1 parent 950fa8e commit 2940f79e69fb2057cb55e0a1db74b32c6a7df94e @cjc committed Nov 17, 2012
Showing with 21 additions and 1 deletion.
  1. +7 −1 README.md
  2. +14 −0 jquery.quicksandfilter.js
View
@@ -1,4 +1,10 @@
quicksandfilter
===============
-A very simple wrapper for quicksand implementing basic css selector filtering
+A very simple wrapper for quicksand implementing basic css selector filtering
+
+Provides basic filtering using (quicksand)[1]
+
+[1]: https://github.com/razorjack/quicksand
+
+
@@ -0,0 +1,14 @@
+(function ($) {
+ $.fn.quicksandfilter = function(filterselector, itemselector, options){
+ itemselector = itemselector || ' > *';
+ if (!this.data('qsdata')) {
+ this.find(itemselector).each(function(i,elem) {
+ $(elem).attr('data-id', i);
+ });
+ this.data('qsdata', this.clone());
+ }
+ if (filterselector == 'all') filterselector = '';
+ var filtered_data = this.data('qsdata').find(itemselector + filterselector);
+ this.quicksand(filtered_data, options);
+ }
+})(jQuery)

0 comments on commit 2940f79

Please sign in to comment.