Finsweet Attributes

Automatic Filtering

Overview
Attributes Notes
Finsweet Form Submit
401
Finsweet CMS Nest
406
Finsweet CMS Sort
406
Finsweet ToC
407
Finsweet Prev Next
407
Finsweet Rich Text
408
Finsweet Input Counter
410
Finsweet CMS Load
Finsweet CMS Load
501
Responsive Pagination
502
Advanced FS Load
504
Finsweet CMS Filter
Finsweet CMS Filter
650
Automatic Filtering
652
Advanced FS Filter
652
Browser Extension Candies
Finsweet's Unbind CMS
3:41
801
Debugging
Troubleshooting your Finsweet Attributes Config
901
No items found.
Published
July 7, 2023
Updated
in lightbox

Want to automatically apply a filtering configuration to your CMS filter?

You can filter on;

  • On page load, via the querystring
  • On an scripting event, like a button click

Querystring params

FS CMS Filter has an fs-cmsfilter-showquery=true option that you can apply to sync the querystring to the filter settings.

For example, it might add;

?countries=Spain&categories=Museum

Check Finsweet's docs for more.

https://finsweet.com/attributes/cms-filter

Button click or scripting event

Another option, if you have an scripting event such as a button click, you can apply your own custom configuration to the filter settings.

Important code notes;

  • You will need to set each of the filter settings you want ( text fields, options, checkboxes, list items, etc. ) in code.
  • Because script-initiated input changes do not trigger change detection on those fields, you'll need to do that manually, and you'll need to do it on every filter field you modify.

e.g. for a button ID'd button1, that checks a checkbox ID'd checkbox1;

// Button clicked
document.getElementById('button1').addEventListener('click', function() {

    // Set a checkbox to checked
    var checkbox = document.getElementById('checkbox1');  
    checkbox.checked = true;

    // Fire a checkbox changed event
    var event = new Event('change');
    checkbox.dispatchEvent(event);

});

Scrolling on filter

If your filter results are in a DIV id results, you can apply your filtering and then scroll to the results.

  var container = document.getElementById('results');  
  container.scrollIntoView({ behavior: 'smooth' });

Additional Notes

Deferring FS Filter

Untested- but Finsweet's Luis commented that in advanced use cases it may be advantageous to delay the initialization of FS Filter until after FS Load has loaded everything.

That can be achieved by adding this attribute to the FS Filter script element-

defer fs-attributes-preventload='true'

and then initializing FS Filter within the CMS Load callback.

https://forum.finsweet.com/t/load-filter-with-scripts/771/4

FAQs

Answers to frequently asked questions.

Videos
No items found.
Table of Contents
Comments
Did we just make your life better?
Passion drives our long hours and late nights supporting the Webflow community. Click the button to show your love.