Dataset filter does not work

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"
   });
});

@anthonyb:
Thanks for your response. I am glad I am finding the support I need from Wix in providing me a helping hand as I build my first website with Wix.
Okay, I made code changes as you suggested. I moved the dataset5 filter statement to the model-of-car page.

But, my dropdown is not showing any items at all. Nothing happens when I click the dropdown.

Could you please take a look and see if you find any miss? Here is the code I now have:

make-of-car page code

import {session} from ‘wix-storage’ ;
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) => { 

//console.log($w(“#dataset2”).getCurrentItem());
$w( “#text27” ).text = $w( “#text27” ).text + ", " + $w( “#dataset2” ).getCurrentItem().title;
//store the session variable to the make of car before going to model-of-car page
session.setItem( “make” , “Honda” );
wixLocation.to( “/model-of-car” );
});
});

});

model-of-car page code

import {session} from ‘wix-storage’ ;
import wixData from ‘wix-data’ ;

$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" ; 
}); 

});

export function dropdown1_change(event) {
$w( ‘#text27’ ).text = $w( ‘#text27’ ).text + ', ’ + $w( ‘#dropdown2’ ).value;
}

Thanks for your response. I posted my reply clicking on answer by mistake!

Firstly, I am glad I am finding the support I need from Wix in providing me a helping hand as I build my first website with Wix.
Okay, I made code changes as you suggested. I moved the dataset5 filter statement to the model-of-car page.

But, my dropdown is not showing any items at all. Nothing happens when I click the dropdown.

Could you please take a look and see if you spot any miss? Not sure if I am missing some config settings for the dropdown. Here is the code I now have:

make-of-car page code

import {session} from ‘wix-storage’ ;
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) => { 

//console.log($w(“#dataset2”).getCurrentItem());
$w( “#text27” ).text = $w( “#text27” ).text + ", " + $w( “#dataset2” ).getCurrentItem().title;
//store the session variable to the make of car before going to model-of-car page
session.setItem( “make” , “Honda” );
wixLocation.to( “/model-of-car” );
});
});

});

model-of-car page code

import {session} from ‘wix-storage’ ;
import wixData from ‘wix-data’ ;

$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" ; 
}); 

});

export function dropdown1_change(event) {
$w( ‘#text27’ ).text = $w( ‘#text27’ ).text + ', ’ + $w( ‘#dropdown2’ ).value;
}

Works awesome! Thanks for your help!