@finsweet/attributes-cmssort

1.13.3 • Public • Published

cmssort Attribute

Create advanced and complex no-code sorting for Webflow CMS Collection List content.

CDN Import

<!-- [Attributes by Finsweet] CMS Sort -->
<script async src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmssort@1/cmssort.js"></script>

JavaScript API

You can access the cmssort instances by pushing a callback into the window.fsAttributes object:

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

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

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

The callback passes an array with all the CMSList instances on the page. To see more about the CMSList instance, check the cmscore docs.

Package Sidebar

Install

npm i @finsweet/attributes-cmssort

Weekly Downloads

468

Version

1.13.3

License

none

Unpacked Size

16.5 kB

Total Files

5

Last publish

Collaborators

  • erikmejias
  • alexiglesias