I have a repeater on the "make-of-car" page of my website with buttons labeled as Honda, Toyota, etc.
When I click on a button labeled,say Honda, I want a dropdown, to be shown on another page called the "model-of-car" page, populated with Honda models such as Accord, Civic, etc.
The dropdown is set to "Show on All Pages". So I hide the dropdown on the "make-of-car" page and show it on the "model-of-car" page.
In the below code, dataset2 is connected to the repeater buttons, and dataaset5 is connected to the dropdown.
The problem is, the dropdown filter does not work. It does not filter and show only models pertaining to Honda. Instead, it shows all the models of all makes of cars.
I dont know where I am going wrong, or what changes I need to make to get the filter to work properly.
make-of-car page code
=================
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady( function () {
$w("#dropdown2").hide();
$w("#text25").text= "SELECT MAKE"
$w("#repeater2").onItemReady( ($w, itemData, index) => {
$w("#button2026").onClick( (event) => {
$w("#text27").text = $w("#text27").text + ", " + $w("#dataset2").getCurrentItem().title;
$w("#dataset5").onReady(() => {
$w("#dataset5").setFilter(wixData.filter().eq("title", "Honda"));
});
wixLocation.to("/model-of-car");
});
});
});
model-of-car page code
==================
import wixData from 'wix-data';
$w.onReady(function () {
$w("#dropdown2").show();
$w('#text25').text= "SELECT MODEL"
});
@inayat_jilani Looks like you are expecting the filter set in the make-of-car page to be active in the model-of-car page. Unfortunately, it doesn't work that way. What you can do is use storage to store the filter value, and then retrieve that value in the model-of-car page.
Have this line at the top of the make-of-car page
import {session} from 'wix-storage';
Right before the wixLocation.to line store the value:
session.setItem("make","Honda");
Transfer the dataset5 filter statement to the make-of-car page, something like this:
import {session} from 'wix-storage'; $w.onReady(function () { let make = session.getItem("make"); $w("#dataset5").onReady(() => { $w("#dataset5").setFilter(wixData.filter().eq("title",make); $w("#dropdown2").show(); $w('#text25').text= "SELECT MODEL" }); });