It would be very interesting to find the way to customizing a dropdown box from Wix Code for visitors in order to being able to switching from an item of a dynamic item page to any specific item from a database . For example, if the dynamic item page displays fields related to information of an edition of a festival, it would be really cool that visitors could choose which specific edition (which specific item) data appears in the dynamic page. In other words, if they are in 30th edition and they want to see the 43th edition data, if they choose “43th edition” option in the dropdown box, the data from 43th edition will automatically appear.
Here you have our questions:
Which is the way to programme dropdown box (or other switching buttons) to achieving that effect?
How could we achieve the same effect by using previous/next buttons ? (By the way, the article which you suggest us previously is read, but having it explained by you in an easier way would be awesome!)
Hope you can reply us with an answer to every single question as soon as possible.
This just what I need but I can’t get the buttons to work my site is n.stark67.wixsite.com.mysite-1
maybe you can see what I can’t I tried many variations on what I think your says.
…it did work! Although it cycles through my items in the database, displaying text and title perfectly, but it doesn’t update the images. It does indeed update the position of the images (in function of the presence/absence of content in the item’s database fields, but showing the old item’s images. I’ve tried some refresh codes and nothing…
Now I’m trying to figure out how to filter the dataset based on the user’s inputs BEFORE saving the URL’s. I have 100 pages of galleries and the user can select by year or title keyword. It’s this subset of items I want to capture before going to the category page.
What could I change to capture URLs in the dataset based on what the user has selected only? Would I add code within my filter functions instead of on ready?
This is my page code. Thanks in advance for any help here. (I was delighted to find the article!)
import wixData from "wix-data";
import { local } from 'wix-storage';
const linkField = "link-photogalleries-title";
$w.onReady(function () {
$w("#dynamicDataset").onReady(() => {
const numberOfItems = $w("#dynamicDataset").getTotalCount();
$w("#dynamicDataset").getItems(0, numberOfItems)
.then((result) => {
const dynamicPageURLs = result.items.map(item => item[linkField]);
local.setItem('dynamicPageURLs', dynamicPageURLs);
})
.catch((err) => {
console.log(err.code, err.message);
});
});
})
//search by school year
export function Year_change(event) {
let searchyear = $w("#Year").value;
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("schoolYear", searchyear));
wixData.query("PhotoGalleries")
.contains("year", $w('#Year').value)
.find().then((results) => {
});
}
//search by title
function title() {
let searchtitle = $w("#titleSearch").value;
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", searchtitle));
wixData.query("#dynamicDataset")
.contains("title", $w('#titleSearch').value)
.find()
}
export function titleSearch_change(event, $w) {
title();
}
//clear search criteria
export function clear_click(event) {
$w("#titleSearch").value = "";
$w("#Year").value = "";
$w("#dynamicDataset").setFilter(wixData.filter());
}