Seriously my brain is on fire after days of searching for a solve.. Photography client has a Collection made up of 3-4 sub-categories. For example: "Property" Collection is made up of 'Property (All)', 'residential', 'rural', 'commercial' These are all displayed in a media gallery. All need to be filtered out separately through the user input dropdown. I need to be able to link to a 'filtered' result from an external page. I'll use "residential" as an example.
Prior to adding the dropdown , I could link to a "subcategory" using it's url, (www....property/residential) from another page. The home page has images with links, if I click on an image that represents "residential", i would be taken to the subcategory www....property/residential and it happily showed me only the residential images. After adding the dropdown , linking from the home page, ignores the dynamic "property/residential" URL and it shows me the "rural" images. Although the dropdown still works to cycle though my categories, I'd like it to be initially representative of the active URL on load. or disabled on each page until the user needs to use it. I hope this makes sense. I just want to the user to be able to click on an image from the home page, link to its corresponding category gallery, then be able to search through the filters after that.
@Yisrael (Wix) Yeah I know...blarggh...I'm trying to understand the set vs get gallery API things.. thanks, back to the drawing board... man I hope this works if/when i finally figure it out. Thanks again for your patience.
@Yisrael (Wix) Amended, thanks, please one last thing before my brain slithers away. Or just anyone with the patience for a code noob.
The code I've used is from this doc: https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality
It mentions that because the table/gallery isn't connected via a dataset that it needs to be defined /filled using code. I've attempted the onready function, trying to adapt it from the table API. I cant find an example with the use of gallery APIs.
$w.onReady(function () {
$w("#gallery1").items = [{
"datapath": "gallery"
"type": "image"
} Not working.......*sets face on fire
You need to use database collection field keys (and not field names):
Not this:
.contains("Title", $w("#icatergory").value)
But this:
.contains("title", $w("#icatergory").value)
@Yisrael (Wix) Thanks for pointing me there. This is the code I have set up on the Dynamic page, the dropdown lists all of categories, but the pro gallery doesn't show the images. In fact the gallery shows the default wix images at first, then once i've made a selection in the dropdown the gallery disappears.
I have adapted the code as best I could from a table to a gallery using the gallery API's, But i'm failing at getting the dropdown to talk to the Gallery. I tried the below, in bold as my adaptations. No worky. $w.onReady(function () { });import wixData from "wix-data"; export function icatergory_change(event) { // Runs a query on the "property" collection wixData.query("Property") // Query the collection for any items whose "Name" field contains // the value the user selected in the dropdown .contains("Title", $w("#icatergory").value) .find() // Run the query .then(res => { // Set the table data to be the results of the query $w("#gallery1").items = res.items; }); $w.onReady(function () { $w("#gallery1").items = [{ "datapath": "Gallery" "type": "image" } Am I on the right path? Thanks again. Legend.
@Yisrael (Wix) Hi there, thanks a lot for chiming in. I'm not currently using any code, but it seems I may need to. That's why i'm seeking help here. I'm also a spaz at explaining so I'll add links.
Nut shell, i want to link to a pre-filtered result, but I cant use dataset filtering.
Home page:
https://cjdretouch.wixsite.com/mysite-1
For example the client wants to be able to click on the 'residential' image from the home page and be taken to the property "collection" page and shown only the images from the residential gallery, then also have access to filter through other subcategories from the same dataset using a dropdown. So I can't filter using the dataset. It needs to be user input. You'll see on the page, its residential URL, but not showing resi images: https://cjdretouch.wixsite.com/mysite-1/property/residential It only shows the correct images when there is no dropdown added. As soon as the drop down is added it shows the rural images (presumably the newest entry to the dataset) So i was wondering if I set the dropdown somehow to load as an empty field or refer to an empty field from the dataset, if it would then show the images associated with the URL Thanks for your patience. =)
You will need to provide more information. Explain what you are trying to do, what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines.