SHARE
TWEET

filter.js

a guest Oct 22nd, 2012 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <a class="filter_by_link" href="#" data-value="2" data-target='#country_filter'>Country NL</a>
  2.       <input type="hidden" id="country_filter"/>
  3.  
  4. <a class="filter_by_link" href="#" data-value="10-20" data-target='#link_filter'>Price: 10 - 20</a>
  5.     <a class="filter_by_link" href="#" data-value="20-30" data-target='#link_filter'>Price: 20 - 30</a>
  6. <input type="hidden" id="link_filter"/>
  7.  
  8.  
  9.  
  10. $('.filter_by_link, #clear_link_filter').click(function(e){
  11.   e.preventDefault();
  12.   $($(this).data('target')).val($(this).data('value'));
  13.   fJS.filter();
  14. });
  15. // the filter settings
  16. // selector, type, event, criteria, json attribute
  17. // .type range for numbers including the specials below-xy and xy-above
  18. // example <input checked="checked" value="20-above" type="checkbox">
  19. var settings = {
  20.   filter_criteria: {
  21.     link_filter: ['#link_filter .EVENT.change .SELECT.:input .TYPE.range', 'age'],
  22.         age: ['#country_filter .EVENT.change .SELECT.:input ', 'country_id']
  23.  
  24.  
  25.   },
  26. and_filter_on: true //If any filter selection is zero then select none. For 'OR' filter set 'false'
  27. };
  28.  
  29. // Trigger the filtering (json src, target html, the template, filter settings)
  30. var fJS = new FilterJS(people, "#something", view, settings);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top