Hi, I’m trying to filter a gallery connected to a dataset. On my database collection I have each image associated to tags, and I want fo use those tags to filter and display the images that are associated with the tags selected by the user. I´ve found here on this forum an example that works exactly as I need with mine: https://eyalcwix.wixsite.com/selectiontags-filter
But all the instructions I find is to filter Repeaters, not Galleries. I need it to be a gallery, pecause repeaters crop os adjust my images and i want them to appear in their original different proportions (as in the example above).
Can anyone help me with a code for that?
1 Like
Hi TANTO,
You could just use a repeater and add a bit of code to change the size of images.
Check my forum comment: How to change the size for the placeholder image in a repeater .
Try this, using this code.
import wixData from'wix-data';
$w.onReady(function(){
$w('#selectionTagsID').onChange(()=>{
const selectedTag =$w('#selectionTagsID').value;
let filter = wixData.filter();
if(selectedTag.length >0){
filter = filter.hasSome("FIELDKEY", selectedTag);
}
$w('#datasetID').setFilter(filter);
})
});
Here’s the tutorial step by step https://www.wix.com/velo/forum/tips-tutorials-examples/how-to-filter-wix-gallery-using-selection-tags
Is it possible to filter a wix photo gallery that is connected to a FIELD TYPE “media gallery” in a collection?? I need multiple photos filtered by selection tags.
Please help!!!
@walterodibi thank you very much but maybe I’m missing something. The tutorial shows how to connect the field type IMAGE (which is only 1 photo) from a collection. But I am trying to connect the field type MEDIA GALLERY (with multiple photos) in my collection. Is this possible?