0

https://russian-dima.wixsite.com/wixworld/nedvizhimost-iiii this site is exactly I'm trying to create. I coded all dropdowns but price filter code doesn't work. I don't know why!

import wixData from 'wix-data';
export function button14_click(event) {
    $w.onReady(function () {
        let min = Number($w("#input1").value)
        let max = Number($w("#input2").value)

        $w("#dataset1").setFilter(wixData.filter().between("fiyat", min, max))

            .then((results) => {
                console.log("Dataset is now filtered");
                $w('#propertyList').data = results.items;
            });
    })

2 Answers 2

0

Why is there an onReady in there? I would guess that is your problem.

Sign up to request clarification or add additional context in comments.

Comments

0

The $w.onReady method should be at the root of the page, it is the method that runs on page load.

You could create the button onClick inside of the $w.onReady method like this:

import wixData from 'wix-data'

$w.onReady(async function () {
  //Await the dataset to be ready
  await $w('#dataset1').onReadyAsync()

  //Click event for the button
  $w('#button14').onClick(async function () {
    let min = Number($w('#input1').value)
    let max = Number($w('#input2').value)

    await $w('#dataset1').setFilter(wixData.filter().between('fiyat', min, max))
    //Refresh the dataset
    await $w('#dataset1').refresh()
  })
})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.