Link Dropdown Value to a Dynamic Page

Hello everyone, I’m trying to use the wixLocation.to to navigate to a Dynamic Item Page from a Dynamic Page.
Can anyone help?
My database is called: UsaAirlines
My dynamic page is: UsaAirlines (Country, Category, Airline Name)


At the moment i’m using the setFilter of the Dynamic Dataset on the dynamic page and it works fine, but once the page changes, some items of that dynamic retrieved using the getCurrentItem method do not respond properly.
So that’s why I thought of using the wixLocation.to to navigate from page to page.

Thank You

Please add more details and describe what exactly you want to happen and when. You can also add images that describe the scenario.

Hi J.D.
ok here it is:

This is my Dynamic Item Page , as you can see i have 2 dropdowns and each page has buttons (GO button) that link to an external link. i used the getCurrentItem for each button.
If there’s no URL then the button gets disables, else enabled.
This code works fine if i go from page to page from a repeater or list, but if i select the value from a dropdown then once the other dynamic page loads, the buttons do not disable even though there’s no URL. as you can see from this pic.
This airline page has only 1 item without link (Airline loyalty).
But actually inside the database there are others also without link, in this case Airline Bookings has no link either, but the button doesn’t get disabled.


this is my code:

export function dynamicDataset_ready_1() {
let websiteField = $w(“#dynamicDataset”).getCurrentItem().airlineWebsite;
let wikipediaField = $w(“#dynamicDataset”).getCurrentItem().airlineWikipedia;
let airlineMovemements = $w(“#dynamicDataset”).getCurrentItem().airlineMovements;
let airlineReviews = $w(“#dynamicDataset”).getCurrentItem().airlineReviews;
let airlineRatings = $w(“#dynamicDataset”).getCurrentItem().airlineRatings;
let airlineSeats = $w(“#dynamicDataset”).getCurrentItem().airlineSeatMaps;
let airlineDeals = $w(“#dynamicDataset”).getCurrentItem().airlineDeals;
let airlineLoyalty = $w(“#dynamicDataset”).getCurrentItem().airlineLoyalty;
let airlineReservations = $w(“#dynamicDataset”).getCurrentItem().airlineReservations;
let airlineBookings = $w(“#dynamicDataset”).getCurrentItem().airlineBookings;
let iataCode = $w(“#dynamicDataset”).getCurrentItem().iataCode;

if (iataCode === null ) {
$w(“#iataCodeText”).hide();
}

if (websiteField === null ) {
$w(“#airlineWebsiteButton”).disable();
}
if (wikipediaField === null ) {
$w(“#airlineWikiButton”).disable();
}
if (airlineMovemements === null ) {
$w(“#airlineMovementsButton”).disable();
}
if (airlineDeals === null ) {
$w(“#airlineDealsButton”).disable();
}
if (airlineReservations === null ) {
$w(“#airlineHelpButton”).disable();
}
if (airlineReviews === null ) {
$w(“#airlineReviewsButton”).disable();
}
if (airlineRatings === null ) {
$w(“#airlineRatingsButton”).disable();
}
if (airlineSeats === null ) {
$w(“#airlineSeatMapsButton”).disable();
}
if (airlineLoyalty === null ) {
$w(“#airlineLoyaltyButton”).disable();
}
if (airlineBookings === null ) {
$w(“#airlineBookingsButton”).disable();
}
}

That’s why I Thought to navigate from page to page using the wixLocation.to instead of filtering the DynamicDataset.
So I’d like to know which code I can write to get the right Dynamic Page from the item in the dropdown?

I’m still not sure I fully understand the case.
Did you select a value from a dropdown and then navigated to his page?

@jonatandor35 Yes using DatasetFilter, but I want the same using wixLocation.to

@jonatandor35
this is my actual code using the DatasetFilter.
I want the same function but instead of using the DatasetFilter, i want to use the wixLocation

export function usAirlinesName_change_1(event) {
dynamicDataset_ready_1();
let searchValue = $w(“#usAirlinesName”).value;
$w(“#dynamicDataset”).setFilter(wixData.filter().eq(“airlineNameLine1”, searchValue));
$w(‘#airportsTable’).collapse();
$w(“#mobileRepeater”).collapse();
setTimeout(() => {
$w(“#dynamicStrip”).expand();
},2000)
}

@alessuae If I got you correctly (and I’m not sure I did), all you have to do is to run the above-mentioned “if” conditions (the button disabling) inside the onChange function (after setFilter).

@jonatandor35 I tried that too, but it doesnt work, the buttons do not get disabled either.
The buttons gets disabled only if I access the dynamic page from a repeater