Combine + Sort by button auto click only working once

Hello
I’m stuck with this and can’t find a working solution.

For some reason the auto button click to sort the combined CMS-list does only work once. I need this function to work every time the site loads because visitors can visit pages more than once.

The Combine+Sort feature needs to work on other pages too. But at the moment it’s only set up on the homepage. I’m open for different solutions.

My goal is to automatically sort combined lists alphabetically by “name”. I’m guessing that the code fires at the wrong moment or something like this. Timeout for the auto click didn’t work either.

Please help! This function is key for the website.

Here is the URL: Homepage

Here is the Webflow read only link: https://preview.webflow.com/preview/hegikochkolb?utm_medium=preview_link&utm_source=designer&utm_content=hegikochkolb&preview=7e7ccbf85cd5c0fd9330b27bc0f89139&workflow=preview

Thank you so much!
Felix

hey @felix.schmidli95! You could try using the CMS Combine callback to ensure the script has finished combining the lists to then click the sort trigger.

You can replace the current click line with this snippet

<script>
  window.fsAttributes = window.fsAttributes || [];
  window.fsAttributes.push([
    'cmscombine',
    (listInstances) => {
      console.log('cmscombine Successfully loaded!');
      document.querySelector('.fs_cmssort_button').click();
    },
  ]);
</script>
1 Like

It works perfectly! You’re my hero Luis :smiley:

1 Like

You are welcome Felix! Glad to know it works! :muscle:

1 Like