Set the data of a gallery from a database query

Hi,

I have a repeater with a selection of images gallery-based, and it works:

$w . onReady (() => {

let galpicture = $w ( “#PhotoDB” ). getCurrentItem ();

$w . onReady ( function () {
$w ( “#repeater1” ). onItemReady ( ( $item , itemData , index ) => {
$item ( “#image1” ). src = itemData . pic ;
} );

wixData . query ( “PhotoDB” )
. contains ( “gallery” , galpicture . gallery )
. find ()
. then ( ( results ) => {
$w ( “#repeater1” ). data = results . items ;
} );
} );

$w ( “#repeater1” ). forEachItem ( ( $item , itemData , index ) => {
$item ( “#image1” ). src = itemData . pic ;
} );

Now I want to show these images in a Wix Pro Gallery (#gallery1); I would like horizontal scrolling of images.

So, I would like to set the data of a gallery from a database query

I really appreciate any help you can provide.

Stefano

Try out

$w.onReady(() => {
  let galpicture = $w("#PhotoDB").getCurrentItem(); 

  $w.onReady(function () {
    $w("#repeater1").onItemReady( ($item, itemData, index) => {
      $item("#image1").src = itemData.pic;
    } );

    wixData.query("PhotoDB")
      .contains("gallery", galpicture.gallery) 
      .find()
      .then( (results) => {
        $w("#repeater1").data = results.items;
        $w("#myGallery").src = $w("#repeater1").data;
        $w("#myGallery").scrollDirection = "horizontal";
      } );
  } );

  $w("#repeater1").forEachItem( ($item, itemData, index) => {
        $item("#image1").src = itemData.pic;
  } );
});

Thank you, but don’t work.

Properties ‘src’ and 'scrollDirection" don’t exist on type Gallery.

Stefano