top of page

Paris Spaghetti

Italian, French

$

50

London, Worldwide

Potato House Diner

Italian, French

$

80

Worldwide, London

Rolled & Scrambled Eggs

French

$

60

Worldwide

The Roasted Chicken

French

$

90

London

Chips & Pastry

Italian

$

70

London

Yellow Cab

Italian

$

100

Worldwide

import wixData from 'wix-data';

import { local } from 'wix-storage';

// ...

 

export function searchButton_click_1(event) {

    search();

 

    //SAVE ITEMS ON LOCAL STORAGE

    let loc = $w("#dropdown1").value;

    let cuis = $w("#dropdown2").value;

 

    local.setItem("location", loc);

    local.setItem("cuisine", cuis);

}

 

function search() {

 

    wixData.query("Restaurant")

        .contains("location", String($w("#dropdown1").value))

        .and(wixData.query("Restaurant").contains("cuisine", String($w("#dropdown2").value)))

 

        .find()

        .then(results => {

            $w("#repeater1").data = results.items;

        });

 

}

 

//GET ITEM FROM LOCAL STORAGE

$w.onReady(() => {

 

    let locat = local.getItem("location");

    let cuisin = local.getItem("cuisine");

 

    $w("#dropdown1").value = locat;

    $w("#dropdown2").value = cuisin;

 

    wixData.query('Restaurant')

        .contains("location", locat)

        .and(wixData.query('Restaurant').contains("cuisine", cuisin))

        .find()

        .then((results) => {

            $w("#repeater1").data = results.items;

        });

 

});

 

//Reset Filter

export function resetButton_click(event) {

 

    $w("#dataset1").setFilter(wixData.filter())

 

    $w("#dropdown1").value = undefined;

    $w("#dropdown2").value = undefined;

 

    //REMOVE SAVED ITEM FROM LOCAL STORAGE

    local.removeItem("location");

    local.removeItem("cuisine");

}

Copied!

bottom of page