After using reset button, no filters work anymore

Hi everyone,

I’ve set up three filter inputs connected to a dataset (#dynamicDataset):

  • #dropdown1 (Text field – “kunde”)
  • #dropdown2 (Tags field – “Leistungen”)
  • #selectionTags1 (Tags field – “Kategorien”)

Everything works perfectly – until I click the reset button.

This is the code I’m using:

import wixData from 'wix-data';

$w.onReady(function () {
    
   $w('#clearButton').onClick(() => {
       
       // Clear filters
       $w("#dynamicDataset").setFilter(wixData.filter());

       // Reset inputs
       $w("#dropdown1").value = null;
       $w("#dropdown2").value = null;
       $w("#selectionTags1").value = null;

   }); 
});

The strange part:
The reset works great the first time – all filters are cleared and the dataset displays all items again.
But after that, none of the filters work anymore – any new selection has no effect.

Does anyone know what could be causing this?

Thanks in advance :folded_hands:
Alex

Have you got a link to the site/page it is happening on? I’m guessing you’re using a combination of dataset and code, right?

Generally speaking, it’s encouraged to use either code, or datasets (although they do work together in most cases) - it just allows for better control over the flow, rather than splitting the logic between 2 places.

Yes, I’m using a combination of datasets and code.
Thanks for the tip – I wasn’t aware that using just one approach is generally better. That might actually explain some of the issues I’ve been having.

Here’s the link to the page where it’s happening:

If you have any ideas on how to improve the setup, I’d really appreciate it!

Seems to be working perfectly fine. Is there a specific reason why you’re using code? This is because a reset button can simply be connected to the dataset and linked to Reset Input Values; no code required.