Finsweet Attributes

Advanced FS Filter

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

Here are some more advanced FS Filter + FS Load setup tips.

Deferring FS Filter

Untested by our team, but noted here for future needs.

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.

<script>
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
  'cmsload',
  (listInstances) => {
    console.log('cmsload Successfully loaded!');

    // The callback passes a `listInstances` array with all the `CMSList` instances on the page.
    const [listInstance] = listInstances;

    window.fsAttributes.cmsfilter.init();

    // The `renderitems` event runs whenever the list renders items after switching pages.
    listInstance.on('renderitems', (renderedItems) => {
      console.log(renderedItems);
    });
  },
]);
</script>

FS Filter API

Finsweet CMS Filter has an API which allows you to handle callback events and perform certain actions.

The basic framework looks like;

<script>
  window.fsAttributes = window.fsAttributes || [];
  window.fsAttributes.push([
    'cmsfilter',
    (filterInstances) => {
      console.log('cmsload Successfully loaded!');

      const [filterInstance] = filterInstances;

	  // YOUR CODE HERE

    },
  ]);
</script>

Within that setup function, you can setup additional event handlers for specific tasks;

RenderItems

Runs whenever the list renders items after switching pages

filterInstance.listInstance.on('renderitems', (renderedItems) => {
  console.log('renderitems event', renderedItems);
});

AddItems

filterInstance.listInstance.on('additems', (addedItems) => {
  console.log('additems event', addedItems);
}); 

SwitchPage

filterInstance.listInstance.on('switchpage', (targetPage) => {
  console.log('switchpage event', 'The user has navigated to the page number ', targetPage);
});

References

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.