Set filter in page-1 and result filter in page-2

Please help me

page-1 (set filter)

Page-2 (result filter from page-1) and on page 2 also has a working filter feature

set filter page 1 dropdown only

What you can do is the following…
You can use wix-local-storage to get your saved data on another page of your site.

  1. First you do your filtering process.
  2. Then you save your results in the local storage.
  3. Then you navigate to your next choosen page.
  4. And load all the saved data into your filter on the new page.

I made it like this:

  1. save your values in local storage
  2. paste the vales on the next page (for example if you write “test” in the searchbar (1. side) then your code pastes this text in the searchbar on side 2
  3. then filter

Here’s my code on 1. Page:

import { session } from 'wix-storage';
import wixLocation from 'wix-location';

export function Suchen_click(event) {
    session.clear();
 let Eingabe = $w("#Suchleiste").value;

    session.setItem("SuchenWort", Eingabe);

 if ($w("#checkbox1").checked === true) { session.setItem("Verleih", $w("#checkbox1").value); }


    wixLocation.to(`/your-2.page`);
}

On the 2. page:

import wixData from 'wix-data';
import { session } from 'wix-storage';

$w.onReady(function () {

 // Übertrag von Vorseite
 var sameWord = session.getItem("SuchenWort");

    $w("#Suchleiste").value = sameWord;
 if ($w("#checkbox1").value === session.getItem("Verleih")) { $w("#checkbox1").checked = true; }

    session.clear();

 // auszuführende Funktion
    $w('#datasetBayern').onReady(function () {
        FilterSteckerBayern();
        Suchleiste_debounce();
    });

“FilterSteckerBayern” is your filter.
“Suchleiste_debounce” is the debounce for the searchbar.

So the first part of the code transfers the text in the searchbar and if a checkbox is checked or not.

And this code here:

    $w('#datasetBayern').onReady(function () {
        FilterSteckerBayern();
        Suchleiste_debounce();
    });

runs your filter with the selected values.

I hope you unterstand what I want to tell you (my english is very bad).

Yes looks good Nik. Could work for Gundrock.
Aber ich verstehe nicht warum du jedes mal das SESSION clearst?
Wird eh beim nächsten Prozess wieder überschrieben oder nicht?:wink:

@russian-dima Ist einfach sicherheitshalber, damit keine Fehler passieren. Beim 1. Code könnte man den Clear weglassen, aber es kann passieren, dass er deine Filtereinstellungen übernimmt wenn du von der 2. Seite auf die 1. zurückgehst.
Habe davor auch mit “local” gearbeitet, damit buggt es aber manchmal.

Deepl translation:
It is simply for safety, so that no mistakes happen. With the 1st code you could leave out the Clear, but it can happen that it takes over your filter settings when you go back from the 2nd side to the 1st.
I have worked with local before, but sometimes it bugs with it.