I have 2 repeaters. Both have a gallery (the older strip gallery, not pro) in them. One is ItemRepeater1 and the other is ItemRepeater2.
I have to records in my table. They have an image field and a text field named item_sort. I want the record with sort 1 to go into repeater1 and 2 to go into repeater2. Right now that seems to work but I want the gallery to collapse if there is no image with the proper sort. My code and a screenshot is below.
wixData.query( ‘tutorials_sub1’ ).contains( ‘tutorials_top_id’ , $w( “#idBox” ).text)
.and(wixData.query( ‘tutorials_sub1’ ).contains( ‘item_sort’ , ‘1’ ))
.find()
.then((results) => {
if (results.items.length > 0 ) {
$w( "#textBox" ).collapse();
$w( "#textBox" ).collapse();
} **else** {
$w( '#itemRepeater1' ).data = results.items;
$w( "#textBox" ).expand();
$w( "#textBox" ).show();
}
}
)
wixData.query( ‘tutorials_sub1’ ).contains( ‘tutorials_top_id’ , $w( “#idBox” ).text)
.and(wixData.query( ‘tutorials_sub1’ ).contains( ‘item_sort’ , ‘2’ ))
.find()
.then((results) => {
if (results.items.length > 0 ) {
$w( "#imageBox" ).collapse();
$w( "#imageBox" ).collapse();
} **else** {
$w( '#itemRepeater2' ).data = results.items;
$w( "#imageBox" ).expand();
$w( "#imageBox" ).show();
}
}
)