Gallery Search Not Displaying Images

I’m looking for a way to display a “Search” result coming from a dropbox selection to preview on a gallery. I found an example in this forum were the results of the search were being shown in a table, however I want them to be displayed on a gallery. I modified the original code to display it on the gallery using “$w(”#gallery1").items = res.items;" However, this only displayed the names of the images, not the images themselves.

This is what I did:

import wixData from 'wix-data';
export function dropbox_onChange(event) {
	
	$w.onReady(function () {
		wixData.query('Collection')
		.contains("type", $w("#dropbox").value)
		.find()
		.then(res => {
			$w("#gallery1").items = res.items;
});
});	
}

Any thoughts on what could be wrong?

Note: I did link the gallery’s images to the database images.

Hey there,

The table and gallery items properties take arrays of different objects. In the case of a gallery you need to set the items property with an array of GalleryItem objects . That means you code will need to do a little more work to convert the query items into GalleryItems.